From: Gildas Bazin Date: Sun, 30 Mar 2003 14:24:20 +0000 (+0000) Subject: * include/configuration.h: added the add_directory() config macro. X-Git-Tag: 0.5.3~59 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=17a31fd8921f4bb1b441d48d312449732e696a62;p=vlc * include/configuration.h: added the add_directory() config macro. * modules/gui/wxwindows/preferences.cpp: support for add_string_from_list(). * ALL: changed some add_string() config options to add_file(). --- diff --git a/include/configuration.h b/include/configuration.h index 7ff00b7fd9..b874af042a 100644 --- a/include/configuration.h +++ b/include/configuration.h @@ -4,7 +4,7 @@ * It includes functions allowing to declare, get or set configuration options. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: configuration.h,v 1.25 2003/03/30 11:43:38 gbazin Exp $ + * $Id: configuration.h,v 1.26 2003/03/30 14:24:20 gbazin Exp $ * * Authors: Gildas Bazin * @@ -136,6 +136,8 @@ VLC_EXPORT( void, config_UnsetCallbacks, ( module_config_t * ) ); { static module_config_t tmp = { CONFIG_ITEM_STRING, NULL, name, '\0', text, longtext, psz_value, 0, 0, 0, 0, 0, 0, NULL, ppsz_list }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; } i_config++ #define add_file( name, psz_value, p_callback, text, longtext, advc ) \ { static module_config_t tmp = { CONFIG_ITEM_FILE, NULL, name, '\0', text, longtext, psz_value, 0, 0 }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; } i_config++ +#define add_directory( name, psz_value, p_callback, text, longtext, advc ) \ + { static module_config_t tmp = { CONFIG_ITEM_DIRECTORY, NULL, name, '\0', text, longtext, psz_value, 0, 0 }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; } i_config++ #define add_module( name, psz_caps, psz_value, p_callback, text, longtext, advc ) \ { static module_config_t tmp = { CONFIG_ITEM_MODULE, psz_caps, name, '\0', text, longtext, psz_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; } i_config++ #define add_integer( name, i_value, p_callback, text, longtext, advc ) \ diff --git a/modules/audio_output/file.c b/modules/audio_output/file.c index 9c38d3f81c..96e2abe7a7 100644 --- a/modules/audio_output/file.c +++ b/modules/audio_output/file.c @@ -2,7 +2,7 @@ * file.c : audio output which writes the samples to a file ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: file.c,v 1.18 2003/03/30 14:09:59 sigmunau Exp $ + * $Id: file.c,v 1.19 2003/03/30 14:24:20 gbazin Exp $ * * Authors: Christophe Massiot * Gildas Bazin @@ -101,15 +101,15 @@ static int format_int[] = { VLC_FOURCC('u','8',' ',' '), VLC_FOURCC('f','l','3','2'), VLC_FOURCC('s','p','i','f') }; -#define PATH_TEXT N_("path of the output file") -#define PATH_LONGTEXT N_("By default samples.raw") +#define FILE_TEXT N_("output file") +#define FILE_LONGTEXT N_("file to which the audio samples will be written to") vlc_module_begin(); add_category_hint( N_("Audio"), NULL, VLC_FALSE ); add_string_from_list( "audiofile-format", "s16", format_list, NULL, FORMAT_TEXT, FORMAT_LONGTEXT, VLC_TRUE ); - add_file( "audiofile-path", "audiofile.wav", NULL, PATH_TEXT, - PATH_LONGTEXT, VLC_FALSE ); + add_file( "audiofile", "audiofile.wav", NULL, FILE_TEXT, + FILE_LONGTEXT, VLC_FALSE ); add_bool( "audiofile-wav", 1, NULL, WAV_TEXT, WAV_LONGTEXT, VLC_TRUE ); set_description( N_("file audio output module") ); set_capability( "audio output", 0 ); diff --git a/modules/demux/demuxdump.c b/modules/demux/demuxdump.c index 21ecfe87cf..3903d8df4f 100644 --- a/modules/demux/demuxdump.c +++ b/modules/demux/demuxdump.c @@ -2,7 +2,7 @@ * demuxdump.c : Pseudo demux module for vlc (dump raw stream) ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: demuxdump.c,v 1.6 2003/03/29 12:22:15 gbazin Exp $ + * $Id: demuxdump.c,v 1.7 2003/03/30 14:24:20 gbazin Exp $ * * Authors: Laurent Aimar * @@ -53,8 +53,8 @@ vlc_module_begin(); set_description( _("Dump Demux input") ); set_capability( "demux", 0 ); add_category_hint( "File", NULL, VLC_FALSE ); - add_string( "demuxdump-file", "stream-demux.dump", NULL, FILE_TEXT, - FILE_LONGTEXT, VLC_FALSE ); + add_file( "demuxdump-file", "stream-demux.dump", NULL, FILE_TEXT, + FILE_LONGTEXT, VLC_FALSE ); set_callbacks( Activate, Desactivate ); add_shortcut( "dump" ); vlc_module_end(); diff --git a/modules/demux/util/sub.c b/modules/demux/util/sub.c index d04b721569..a1a104fcda 100644 --- a/modules/demux/util/sub.c +++ b/modules/demux/util/sub.c @@ -2,7 +2,7 @@ * sub.c ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: sub.c,v 1.10 2003/03/16 23:35:39 fenrir Exp $ + * $Id: sub.c,v 1.11 2003/03/30 14:24:20 gbazin Exp $ * * Authors: Laurent Aimar * @@ -67,8 +67,8 @@ vlc_module_begin(); set_description( _("text subtitle demux") ); set_capability( "subtitle demux", 12 ); add_category_hint( "subtitle", NULL, VLC_TRUE ); - add_string( "sub-file", NULL, NULL, - "subtitle file name", "subtitle file name", VLC_TRUE ); + add_file( "sub-file", NULL, NULL, + "subtitle file name", "subtitle file name", VLC_TRUE ); add_float( "sub-fps", 0.0, NULL, "override frames per second", SUB_FPS_LONGTEXT, VLC_TRUE ); diff --git a/modules/gui/wxwindows/preferences.cpp b/modules/gui/wxwindows/preferences.cpp index 9cda6df805..6759c07598 100644 --- a/modules/gui/wxwindows/preferences.cpp +++ b/modules/gui/wxwindows/preferences.cpp @@ -2,7 +2,7 @@ * preferences.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: preferences.cpp,v 1.5 2003/03/30 13:23:27 gbazin Exp $ + * $Id: preferences.cpp,v 1.6 2003/03/30 14:24:20 gbazin Exp $ * * Authors: Gildas Bazin * @@ -92,11 +92,12 @@ struct ConfigData { ConfigData( wxPanel *_panel, int _i_conf_type, vlc_bool_t _b_advanced, char *psz_name ) - { panel = _panel; b_advanced = _b_advanced; + { panel = _panel; b_advanced = _b_advanced; b_config_list = VLC_FALSE; i_config_type = _i_conf_type; option_name = psz_name; } vlc_bool_t b_advanced; int i_config_type; + vlc_bool_t b_config_list; union control { @@ -609,13 +610,35 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf, case CONFIG_ITEM_FILE: case CONFIG_ITEM_DIRECTORY: label = new wxStaticText(panel, -1, p_item->psz_text); - textctrl = new wxTextCtrl( panel, -1, p_item->psz_value, - wxDefaultPosition, wxDefaultSize, - wxTE_PROCESS_ENTER); - textctrl->SetToolTip( p_item->psz_longtext ); - config_data->control.textctrl = textctrl; - panel_sizer->Add( label, 0, wxALL, 5 ); - panel_sizer->Add( textctrl, 1, wxALL, 5 ); + panel_sizer->Add( label, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); + + if( !p_item->ppsz_list ) + { + textctrl = new wxTextCtrl( panel, -1, p_item->psz_value, + wxDefaultPosition, wxDefaultSize, + wxTE_PROCESS_ENTER); + textctrl->SetToolTip( p_item->psz_longtext ); + config_data->control.textctrl = textctrl; + panel_sizer->Add( textctrl, 1, wxALL, 5 ); + } + else + { + combo = new wxComboBox( panel, -1, p_item->psz_value, + wxDefaultPosition, wxDefaultSize, + 0, NULL, wxCB_READONLY | wxCB_SORT ); + + /* build a list of available options */ + for( int i_index = 0; p_item->ppsz_list[i_index]; i_index++ ) + { + combo->Append( p_item->ppsz_list[i_index] ); + } + + combo->SetToolTip( p_item->psz_longtext ); + config_data->control.combobox = combo; + config_data->b_config_list = VLC_TRUE; + panel_sizer->Add( combo, 1, wxALL, 5 ); + } + if( p_item->i_type == CONFIG_ITEM_FILE ) { button = new wxButton( panel, -1, _("Browse...") ); @@ -729,8 +752,12 @@ void PrefsPanel::ApplyChanges() case CONFIG_ITEM_STRING: case CONFIG_ITEM_FILE: case CONFIG_ITEM_DIRECTORY: - config_PutPsz( p_intf, config_data->option_name.c_str(), - config_data->control.textctrl->GetValue() ); + if( !config_data->b_config_list ) + config_PutPsz( p_intf, config_data->option_name.c_str(), + config_data->control.textctrl->GetValue() ); + else + config_PutPsz( p_intf, config_data->option_name.c_str(), + config_data->control.combobox->GetValue() ); break; case CONFIG_ITEM_BOOL: config_PutInt( p_intf, config_data->option_name.c_str(), diff --git a/modules/misc/logger/logger.c b/modules/misc/logger/logger.c index 365e0f14ff..5543f234c4 100644 --- a/modules/misc/logger/logger.c +++ b/modules/misc/logger/logger.c @@ -2,7 +2,7 @@ * logger.c : file logging plugin for vlc ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: logger.c,v 1.5 2003/03/30 11:54:29 sigmunau Exp $ + * $Id: logger.c,v 1.6 2003/03/30 14:24:20 gbazin Exp $ * * Authors: Samuel Hocevar * @@ -86,7 +86,7 @@ static char *mode_list[] = { "text", "html", NULL }; #define LOGMODE_LONGTEXT N_("Specify the log format. Available choices are \"text\" (default) and \"html\"") vlc_module_begin(); add_category_hint( N_("Miscellaneous"), NULL, VLC_FALSE ); - add_string( "logfile", NULL, NULL, N_("log filename"), N_("Specify the log filename."), VLC_FALSE ); + add_file( "logfile", NULL, NULL, N_("log filename"), N_("Specify the log filename."), VLC_FALSE ); add_string_from_list( "logmode", "text", mode_list, NULL, LOGMODE_TEXT, LOGMODE_LONGTEXT, VLC_FALSE ); set_description( _("file logging interface module") ); set_capability( "interface", 0 ); diff --git a/modules/video_output/fb.c b/modules/video_output/fb.c index 17144ba159..d4e5ac778d 100644 --- a/modules/video_output/fb.c +++ b/modules/video_output/fb.c @@ -2,7 +2,7 @@ * fb.c : framebuffer plugin for vlc ***************************************************************************** * Copyright (C) 2000, 2001 VideoLAN - * $Id: fb.c,v 1.3 2003/02/20 01:52:46 sigmunau Exp $ + * $Id: fb.c,v 1.4 2003/03/30 14:24:20 gbazin Exp $ * * Authors: Samuel Hocevar * @@ -66,7 +66,7 @@ static void GfxMode ( int i_tty ); vlc_module_begin(); add_category_hint( N_("Frame Buffer"), NULL, VLC_FALSE ); - add_string( FB_DEV_VAR, "/dev/fb0", NULL, N_("framebuffer device"), NULL, VLC_FALSE ); + add_file( FB_DEV_VAR, "/dev/fb0", NULL, N_("framebuffer device"), NULL, VLC_FALSE ); set_description( _("Linux console framebuffer module") ); set_capability( "video output", 30 ); set_callbacks( Create, Destroy ); diff --git a/src/libvlc.h b/src/libvlc.h index 32abd3646d..db82560939 100644 --- a/src/libvlc.h +++ b/src/libvlc.h @@ -2,7 +2,7 @@ * libvlc.h: main libvlc header ***************************************************************************** * Copyright (C) 1998-2002 VideoLAN - * $Id: libvlc.h,v 1.51 2003/03/29 12:22:15 gbazin Exp $ + * $Id: libvlc.h,v 1.52 2003/03/30 14:24:20 gbazin Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -519,8 +519,8 @@ vlc_module_begin(); add_integer( "spu-channel", -1, NULL, INPUT_SUBT_TEXT, INPUT_SUBT_LONGTEXT, VLC_TRUE ); - add_string( "dvd", DVD_DEVICE, NULL, DVD_DEV_TEXT, DVD_DEV_LONGTEXT, VLC_FALSE ); - add_string( "vcd", VCD_DEVICE, NULL, VCD_DEV_TEXT, VCD_DEV_LONGTEXT, VLC_FALSE ); + add_file( "dvd", DVD_DEVICE, NULL, DVD_DEV_TEXT, DVD_DEV_LONGTEXT, VLC_FALSE ); + add_file( "vcd", VCD_DEVICE, NULL, VCD_DEV_TEXT, VCD_DEV_LONGTEXT, VLC_FALSE ); add_bool_with_short( "ipv6", '6', 0, NULL, IPV6_TEXT, IPV6_LONGTEXT, VLC_FALSE ); add_bool_with_short( "ipv4", '4', 0, NULL, IPV4_TEXT, IPV4_LONGTEXT, VLC_FALSE );