/*****************************************************************************
* preferences.cpp : wxWindows plugin for vlc
*****************************************************************************
- * Copyright (C) 2000-2001 VideoLAN
- * $Id: preferences.cpp,v 1.39 2003/10/29 01:33:27 gbazin Exp $
+ * Copyright (C) 2000-2004 VideoLAN
+ * $Id$
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
#include "wxwindows.h"
#include "preferences_widgets.h"
-#include <wx/notebook.h>
-#include <wx/textctrl.h>
+
#include <wx/combobox.h>
-#include <wx/spinctrl.h>
#include <wx/statline.h>
-#include <wx/treectrl.h>
#include <wx/clntdata.h>
#include <wx/dynarray.h>
{
public:
- ConfigTreeData() { b_submodule = 0; panel = NULL; psz_section = NULL; }
- virtual ~ConfigTreeData() { if( panel ) delete panel; }
+ ConfigTreeData() { b_submodule = 0; panel = NULL; psz_section = NULL;
+ psz_help = NULL; }
+ virtual ~ConfigTreeData() { if( panel ) delete panel;
+ if( psz_section) free(psz_section);
+ if( psz_help) free(psz_help); }
vlc_bool_t b_submodule;
- char *psz_help;
-
PrefsPanel *panel;
wxBoxSizer *sizer;
int i_object_id;
char *psz_section;
+ char *psz_help;
};
/*****************************************************************************
void PrefsDialog::OnResetAll( wxCommandEvent& WXUNUSED(event) )
{
wxMessageDialog dlg( this,
- wxU(_("Beware this will reset your VLC Media Player config file.\n"
+ wxU(_("Beware this will reset your VLC media player preferences.\n"
"Are you sure you want to continue?")),
- wxU(_("Reset config file")), wxYES_NO|wxNO_DEFAULT|wxCENTRE );
+ wxU(_("Reset Preferences")), wxYES_NO|wxNO_DEFAULT|wxCENTRE );
if ( dlg.ShowModal() == wxID_YES )
{
prefs_tree->AddPendingEvent( newevent );
}
-/*****************************************************************************
- * GetCapabilityHelp: Display the help for one capability.
- *****************************************************************************/
-static char * GetCapabilityHelp( char *psz_capability, int i_type)
-{
- if( psz_capability == NULL) return "";
-
- if( !strcasecmp(psz_capability,"access") )
- return i_type == 1 ? ACCESS_TITLE : ACCESS_HELP;
- if( !strcasecmp(psz_capability,"audio filter") )
- return i_type == 1 ? AUDIO_FILTER_TITLE : AUDIO_FILTER_HELP;
- if( !strcasecmp(psz_capability,"audio output") )
- return i_type == 1 ? AOUT_TITLE : AOUT_HELP;
- if( !strcasecmp(psz_capability,"chroma") )
- return i_type == 1 ? CHROMA_TITLE : CHROMA_HELP;
- if( !strcasecmp(psz_capability,"decoder") )
- return i_type == 1 ? DECODER_TITLE : DECODER_HELP;
- if( !strcasecmp(psz_capability,"demux") )
- return i_type == 1 ? DEMUX_TITLE : DEMUX_HELP;
- if( !strcasecmp(psz_capability,"interface") )
- return i_type == 1 ? INTERFACE_TITLE : INTERFACE_HELP;
- if( !strcasecmp(psz_capability,"sout access") )
- return i_type == 1 ? SOUT_TITLE : SOUT_HELP;
- if( !strcasecmp(psz_capability,"subtitle demux") )
- return i_type == 1 ? SUBTITLE_DEMUX_TITLE : SUBTITLE_DEMUX_HELP;
- if( !strcasecmp(psz_capability,"text renderer") )
- return i_type == 1 ? TEXT_TITLE : TEXT_HELP;
- if( !strcasecmp(psz_capability,"video output") )
- return i_type == 1 ? VOUT__TITLE : VOUT_HELP;
- if( !strcasecmp(psz_capability,"video filter") )
- return i_type == 1 ? VIDEO_FILTER_TITLE : VIDEO_FILTER_HELP;
-
- return "";
-}
-
/*****************************************************************************
* PrefsTreeCtrl class definition.
*****************************************************************************/
* Build a tree of the main options
*/
ConfigTreeData *config_data = new ConfigTreeData;
- config_data->psz_section = NULL;
config_data->i_object_id = GENERAL_ID;
- config_data->psz_help = wraptext( GENERAL_HELP, WRAPCOUNT, ISUTF8 );
+ config_data->psz_help = wraptext( GENERAL_HELP, 72 , ISUTF8 );
config_data->psz_section = strdup( GENERAL_TITLE );
- general_item = AppendItem( root_item, wxU(_("General Settings")),
+ general_item = AppendItem( root_item, wxU(_("General settings")),
-1, -1, config_data );
for( i_index = 0; i_index < p_list->i_count; i_index++ )
if( p_item->psz_longtext )
{
config_data->psz_help =
- wraptext( p_item->psz_longtext, WRAPCOUNT, ISUTF8 );
+ wraptext( p_item->psz_longtext, 72 , ISUTF8 );
}
else
{
* Build a tree of all the plugins
*/
config_data = new ConfigTreeData;
- config_data->psz_section = NULL;
config_data->i_object_id = PLUGIN_ID;
- config_data->psz_help = wraptext( PLUGIN_HELP, WRAPCOUNT, ISUTF8 );
+ config_data->psz_help = wraptext( PLUGIN_HELP, 72, ISUTF8 );
config_data->psz_section = strdup( PLUGIN_TITLE );
- plugins_item = AppendItem( root_item, wxU(_("Plugins")),
- -1,-1,config_data );
+ plugins_item = AppendItem( root_item, wxU(_("Modules")),
+ -1, -1,config_data );
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
ConfigTreeData *config_data = new ConfigTreeData;
config_data->psz_section =
wraptext( GetCapabilityHelp( p_module->psz_capability , 1 ),
- WRAPCOUNT, ISUTF8 );
+ 72, ISUTF8 );
config_data->psz_help =
wraptext( GetCapabilityHelp( p_module->psz_capability , 2 ),
- WRAPCOUNT, ISUTF8 );
+ 72, ISUTF8 );
config_data->i_object_id = CAPABILITY_ID;
capability_item = AppendItem( plugins_item,
wxU(p_module->psz_capability),
i_child_index < GetChildrenCount( plugins_item, FALSE );
i_child_index++ )
{
- capability_item = GetNextChild( plugins_item, cookie );
SortChildren( capability_item );
+ capability_item = GetNextChild( plugins_item, cookie );
}
/* Clean-up everything */
void PrefsTreeCtrl::OnSelectTreeItem( wxTreeEvent& event )
{
- ConfigTreeData *config_data;
+ ConfigTreeData *config_data = NULL;
- config_data = FindModuleConfig( (ConfigTreeData *)GetItemData(
- event.GetOldItem() ) );
+ if( event.GetOldItem() )
+ config_data = FindModuleConfig( (ConfigTreeData *)GetItemData(
+ event.GetOldItem() ) );
if( config_data && config_data->panel )
{
config_data->panel->Hide();
wxArrayString array;
module_t *p_module = NULL;
-
+
/* Initializations */
p_intf = _p_intf;
p_prefs_dialog =_p_prefs_dialog,
/* Now put all the config options into a scrolled window */
config_sizer = new wxBoxSizer( wxVERTICAL );
config_window = new wxScrolledWindow( this, -1, wxDefaultPosition,
- wxDefaultSize, wxSTATIC_BORDER | wxHSCROLL | wxVSCROLL );
+ wxDefaultSize, wxBORDER_NONE | wxHSCROLL | wxVSCROLL );
config_window->SetAutoLayout( TRUE );
config_window->SetScrollRate( 5, 5 );
sizer->Add( help ,0 ,wxEXPAND | wxALL, 5 );
}
- }
+ vlc_object_release( p_module );
+ }
sizer->Layout();
SetSizer( sizer );
}
config_window->FitInside();
config_window->Refresh();
}
- return;
+ return;
}