* preferences.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
- * $Id: preferences.cpp,v 1.14 2003/05/12 21:55:01 gbazin Exp $
+ * $Id: preferences.cpp,v 1.20 2003/06/16 21:55:58 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
BEGIN_EVENT_TABLE(PrefsPanel, wxPanel)
/* Button events */
- EVT_BUTTON(Advanced_Event, PrefsPanel::OnAdvanced)
+ EVT_CHECKBOX(Advanced_Event, PrefsPanel::OnAdvanced)
END_EVENT_TABLE()
/*****************************************************************************
* Constructor.
*****************************************************************************/
-PrefsDialog::PrefsDialog( intf_thread_t *_p_intf, Interface *_p_main_interface)
- : wxFrame( _p_main_interface, -1, wxU(_("Preferences")), wxDefaultPosition,
+PrefsDialog::PrefsDialog( intf_thread_t *_p_intf, wxWindow *p_parent)
+ : wxFrame( p_parent, -1, wxU(_("Preferences")), wxDefaultPosition,
wxSize(650,450), wxDEFAULT_FRAME_STYLE )
{
/* Initializations */
p_intf = _p_intf;
- p_main_interface = _p_main_interface;
SetIcon( *p_intf->p_sys->p_icon );
/* Create a panel to put everything in */
if( !strcmp( p_module->psz_object_name, "main" ) )
continue;
- /* Exclude empty plugins */
- p_item = p_module->p_config;
+ /* Exclude empty plugins (submodules don't have config options, they
+ * are stored in the parent module) */
+ if( p_module->b_submodule )
+ p_item = ((module_t *)p_module->p_parent)->p_config;
+ else
+ p_item = p_module->p_config;
+
if( !p_item ) continue;
do
{
if( item == GetSelection() )
{
wxTreeEvent event;
- event.SetItem(item);
-
OnSelectTreeItem( event );
}
}
if( item2 == GetSelection() )
{
wxTreeEvent event;
- event.SetItem(item2);
-
OnSelectTreeItem( event );
}
}
p_sizer->Remove( config_data->panel );
}
- config_data = (ConfigTreeData *)GetItemData( event.GetItem() );
+ /* Don't use event.GetItem() because we also send fake events */
+ config_data = (ConfigTreeData *)GetItemData( GetSelection() );
if( config_data )
{
if( !config_data->panel )
return;
}
- /* Enumerate config options and add corresponding config boxes */
- p_item = p_module->p_config;
+ /* Enumerate config options and add corresponding config boxes
+ * (submodules don't have config options, they are stored in the
+ * parent module) */
+ if( p_module->b_submodule )
+ p_item = ((module_t *)p_module->p_parent)->p_config;
+ else
+ p_item = p_module->p_config;
/* Find the category if it has been specified */
if( psz_section && p_item->i_type == CONFIG_HINT_CATEGORY )
/* Now put all the config options into a scrolled window */
config_sizer = new wxBoxSizer( wxVERTICAL );
config_window = new wxScrolledWindow( this, -1, wxDefaultPosition,
- wxDefaultSize );
+ wxDefaultSize, wxSTATIC_BORDER | wxHSCROLL | wxVSCROLL );
config_window->SetAutoLayout( TRUE );
config_window->SetScrollRate( 5, 5 );
combo->SetValue( wxU(p_parser->psz_longname) );
}
}
+ vlc_list_release( p_list );
combo->SetToolTip( wxU(p_item->psz_longtext) );
config_data->control.combobox = combo;
wxString::Format(wxT("%d"),p_item->i_value),
wxDefaultPosition, wxDefaultSize,
wxSP_ARROW_KEYS,
- 0, 16000, p_item->i_value);
+ -16000, 16000, p_item->i_value);
spin->SetToolTip( wxU(p_item->psz_longtext) );
config_data->control.spinctrl = spin;
panel_sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
wxString::Format(wxT("%f"),p_item->f_value),
wxDefaultPosition, wxDefaultSize,
wxSP_ARROW_KEYS,
- 0, 16000, (int)p_item->f_value);
+ -16000, 16000, (int)p_item->f_value);
spin->SetToolTip( wxU(p_item->psz_longtext) );
config_data->control.spinctrl = spin;
panel_sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
b_advanced = !config_GetInt( p_intf, "advanced" );
OnAdvanced( dummy_event );
- /* Create advanced button */
+ /* Create advanced checkbox */
if( config_array.GetCount() )
{
- wxButton *advanced_button = new wxButton( this, Advanced_Event,
- wxU(_("Advanced...")) );
- sizer->Add( advanced_button, 0, wxALL, 5 );
+ wxCheckBox *advanced_checkbox =
+ new wxCheckBox( this, Advanced_Event, wxU(_("Advanced options")) );
+
+ if( b_advanced ) advanced_checkbox->SetValue(TRUE);
+ sizer->Add( advanced_checkbox, 0, wxALL|wxALIGN_RIGHT, 0 );
}
sizer->Layout();
config_sizer->Layout();
config_window->FitInside();
+ config_window->Refresh();
}
/*****************************************************************************