Commit 0170377d authored by Gildas Bazin's avatar Gildas Bazin

* changed ADD_BOOL and ADD_BOOL_WITH_SHORT config macros to accept a
default value as an argument.
* modified the command line parsing to accept --foo and --no-foo when a
"foo" boolean config option is defined.
* modified the help menu to indicate if the option is enabled or
disabled by default.
parent 9df1a97b
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* It includes functions allowing to declare, get or set configuration options. * It includes functions allowing to declare, get or set configuration options.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: configuration.h,v 1.10 2002/05/03 20:49:30 sam Exp $ * $Id: configuration.h,v 1.11 2002/05/30 08:17:04 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -141,27 +141,25 @@ void config_UnsetCallbacks( module_config_t * ); ...@@ -141,27 +141,25 @@ void config_UnsetCallbacks( module_config_t * );
#define ADD_FLOAT( name, f_value, p_callback, text, longtext ) \ #define ADD_FLOAT( name, f_value, p_callback, text, longtext ) \
{ MODULE_CONFIG_ITEM_FLOAT, name, '\0', text, longtext, NULL, 0, f_value, \ { MODULE_CONFIG_ITEM_FLOAT, name, '\0', text, longtext, NULL, 0, f_value, \
p_callback, NULL, 0 }, p_callback, NULL, 0 },
#define ADD_BOOL( name, p_callback, text, longtext ) \ #define ADD_BOOL( name, b_value, p_callback, text, longtext ) \
{ MODULE_CONFIG_ITEM_BOOL, name, '\0', text, longtext, NULL, 0, 0, \ { MODULE_CONFIG_ITEM_BOOL, name, '\0', text, longtext, NULL, b_value, 0, \
p_callback, NULL, 0 }, p_callback, NULL, 0 },
#define ADD_STRING_WITH_SHORT( name, ch, value, p_callback, text, longtext ) \ #define ADD_STRING_WITH_SHORT( name, ch, psz_value, p_callback, text, ltext ) \
{ MODULE_CONFIG_ITEM_STRING, name, ch, text, longtext, value, 0, 0, \ { MODULE_CONFIG_ITEM_STRING, name, ch, text, ltext, psz_value, 0, 0, \
p_callback, NULL, 0 }, p_callback, NULL, 0 },
#define ADD_FILE_WITH_SHORT( name, ch, psz_value, p_callback, text, longtext ) \ #define ADD_FILE_WITH_SHORT( name, ch, psz_value, p_callback, text, ltext ) \
{ MODULE_CONFIG_ITEM_FILE, name, ch, text, longtext, psz_value, 0, 0, \ { MODULE_CONFIG_ITEM_FILE, name, ch, text, ltext, psz_value, 0, 0, \
p_callback, NULL, 0 }, p_callback, NULL, 0 },
#define ADD_MODULE_WITH_SHORT( name, ch, i_capability, psz_value, p_callback, \ #define ADD_MODULE_WITH_SHORT( name, ch, i_capability, psz_value, p_callback, \
text, longtext) \ text, ltext) \
{ MODULE_CONFIG_ITEM_MODULE, name, ch, text, longtext, psz_value, \ { MODULE_CONFIG_ITEM_MODULE, name, ch, text, ltext, psz_value, \
i_capability, 0, p_callback, NULL, 0 }, i_capability, 0, p_callback, NULL, 0 },
#define ADD_INTEGER_WITH_SHORT( name, ch, i_value, p_callback, text, \ #define ADD_INTEGER_WITH_SHORT( name, ch, i_value, p_callback, text, ltext ) \
longtext ) \ { MODULE_CONFIG_ITEM_INTEGER, name, ch, text, ltext, NULL, i_value, 0, \
{ MODULE_CONFIG_ITEM_INTEGER, name, ch, text, longtext, NULL, i_value, 0, \
p_callback, NULL, 0 }, p_callback, NULL, 0 },
#define ADD_FLOAT_WITH_SHORT( name, f_value, p_callback, text, longtext ) \ #define ADD_FLOAT_WITH_SHORT( name, ch, f_value, p_callback, text, ltext ) \
{ MODULE_CONFIG_ITEM_FLOAT, name, ch, text, longtext, NULL, 0, f_value, \ { MODULE_CONFIG_ITEM_FLOAT, name, ch, text, ltext, NULL, 0, f_value, \
p_callback, NULL, 0 }, p_callback, NULL, 0 },
#define ADD_BOOL_WITH_SHORT( name, ch, p_callback, text, longtext ) \ #define ADD_BOOL_WITH_SHORT( name, ch, b_value, p_callback, text, ltext ) \
{ MODULE_CONFIG_ITEM_BOOL, name, ch, text, longtext, NULL, 0, 0, \ { MODULE_CONFIG_ITEM_BOOL, name, ch, text, ltext, NULL, b_value, 0, \
p_callback, NULL, 0 }, p_callback, NULL, 0 },
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* modules.h : Module management functions. * modules.h : Module management functions.
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: modules.h,v 1.50 2002/05/18 17:47:46 sam Exp $ * $Id: modules.h,v 1.51 2002/05/30 08:17:04 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -132,6 +132,7 @@ typedef struct module_s ...@@ -132,6 +132,7 @@ typedef struct module_s
struct module_config_s *p_config; /* Module configuration structure */ struct module_config_s *p_config; /* Module configuration structure */
vlc_mutex_t config_lock; /* lock used to modify the config */ vlc_mutex_t config_lock; /* lock used to modify the config */
unsigned int i_config_items; /* number of configuration items */ unsigned int i_config_items; /* number of configuration items */
unsigned int i_bool_items; /* number of bool config items */
/* /*
* Variables used internally by the module manager * Variables used internally by the module manager
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* modules_inner.h : Macros used from within a module. * modules_inner.h : Macros used from within a module.
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: modules_inner.h,v 1.21 2002/05/22 17:17:45 sam Exp $ * $Id: modules_inner.h,v 1.22 2002/05/30 08:17:04 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -93,13 +93,15 @@ ...@@ -93,13 +93,15 @@
#define MODULE_INIT_STOP \ #define MODULE_INIT_STOP \
} while( 0 ); \ } while( 0 ); \
p_module->pp_shortcuts[ i_shortcut ] = NULL; \ p_module->pp_shortcuts[ i_shortcut ] = NULL; \
p_module->i_config_items = 0; \ p_module->i_config_items = p_module->i_bool_items = 0; \
for( p_item = p_config; \ for( p_item = p_config; \
p_item->i_type != MODULE_CONFIG_HINT_END; \ p_item->i_type != MODULE_CONFIG_HINT_END; \
p_item++ ) \ p_item++ ) \
{ \ { \
if( p_item->i_type & MODULE_CONFIG_ITEM ) \ if( p_item->i_type & MODULE_CONFIG_ITEM ) \
p_module->i_config_items++; \ p_module->i_config_items++; \
if( p_item->i_type == MODULE_CONFIG_ITEM_BOOL ) \
p_module->i_bool_items++; \
} \ } \
vlc_mutex_init( &p_module->config_lock ); \ vlc_mutex_init( &p_module->config_lock ); \
p_module->p_config = config_Duplicate( p_config ); \ p_module->p_config = config_Duplicate( p_config ); \
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* (http://liba52.sf.net/). * (http://liba52.sf.net/).
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: a52.c,v 1.13 2002/05/27 16:01:42 fenrir Exp $ * $Id: a52.c,v 1.14 2002/05/30 08:17:04 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -72,7 +72,7 @@ void _M( adec_getfunctions )( function_list_t * p_function_list ) ...@@ -72,7 +72,7 @@ void _M( adec_getfunctions )( function_list_t * p_function_list )
/***************************************************************************** /*****************************************************************************
* Build configuration structure. * Build configuration structure.
*****************************************************************************/ *****************************************************************************/
#define DYNRNG_TEXT N_("disable A/52 dynamic range compression") #define DYNRNG_TEXT N_("A/52 dynamic range compression")
#define DYNRNG_LONGTEXT N_( \ #define DYNRNG_LONGTEXT N_( \
"Dynamic range compression makes the loud sounds softer, and the soft " \ "Dynamic range compression makes the loud sounds softer, and the soft " \
"sounds louder, so you can more easily listen to the stream in a noisy " \ "sounds louder, so you can more easily listen to the stream in a noisy " \
...@@ -82,7 +82,7 @@ void _M( adec_getfunctions )( function_list_t * p_function_list ) ...@@ -82,7 +82,7 @@ void _M( adec_getfunctions )( function_list_t * p_function_list )
MODULE_CONFIG_START MODULE_CONFIG_START
ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL )
ADD_BOOL ( "a52-no-dynrng", NULL, DYNRNG_TEXT, DYNRNG_LONGTEXT ) ADD_BOOL ( "a52-dynrng", 1, NULL, DYNRNG_TEXT, DYNRNG_LONGTEXT )
MODULE_CONFIG_STOP MODULE_CONFIG_STOP
MODULE_INIT_START MODULE_INIT_START
...@@ -209,7 +209,7 @@ static int InitThread( a52_adec_thread_t * p_a52_adec ) ...@@ -209,7 +209,7 @@ static int InitThread( a52_adec_thread_t * p_a52_adec )
return -1; return -1;
} }
p_a52_adec->b_dynrng = !config_GetIntVariable( "a52-no-dynrng" ); p_a52_adec->b_dynrng = config_GetIntVariable( "a52-dynrng" );
/* Init the BitStream */ /* Init the BitStream */
InitBitstream( &p_a52_adec->bit_stream, InitBitstream( &p_a52_adec->bit_stream,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_beos.cpp: beos video output display method * vout_beos.cpp: beos video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: vout_beos.cpp,v 1.57 2002/05/22 12:23:41 tcastley Exp $ * $Id: vout_beos.cpp,v 1.58 2002/05/30 08:17:04 gbazin Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -279,7 +279,7 @@ int VideoWindow::SelectDrawingMode(int width, int height) ...@@ -279,7 +279,7 @@ int VideoWindow::SelectDrawingMode(int width, int height)
{ {
int drawingMode = BITMAP; int drawingMode = BITMAP;
int noOverlay = config_GetIntVariable( "nooverlay" ); int noOverlay = !config_GetIntVariable( "overlay" );
for (int i = 0; i < COLOR_COUNT; i++) for (int i = 0; i < COLOR_COUNT; i++)
{ {
if (noOverlay) break; if (noOverlay) break;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* directx.c : Windows DirectX plugin for vlc * directx.c : Windows DirectX plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: directx.c,v 1.9 2002/05/22 19:31:33 gbazin Exp $ * $Id: directx.c,v 1.10 2002/05/30 08:17:04 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -43,11 +43,11 @@ void _M( vout_getfunctions )( function_list_t * p_function_list ); ...@@ -43,11 +43,11 @@ void _M( vout_getfunctions )( function_list_t * p_function_list );
/***************************************************************************** /*****************************************************************************
* Building configuration tree * Building configuration tree
*****************************************************************************/ *****************************************************************************/
#define HW_YUV_TEXT N_("Disable hardware YUV->RGB conversions") #define HW_YUV_TEXT N_("use hardware YUV->RGB conversions")
#define HW_YUV_LONGTEXT N_( \ #define HW_YUV_LONGTEXT N_( \
"Don't try to use hardware acceleration for YUV->RGB conversions. This " \ "Try to use hardware acceleration for YUV->RGB conversions. " \
"option doesn't have any effect when using overlays." ) "This option doesn't have any effect when using overlays." )
#define SYSMEM_TEXT N_("Use video buffers in system memory") #define SYSMEM_TEXT N_("use video buffers in system memory")
#define SYSMEM_LONGTEXT N_( \ #define SYSMEM_LONGTEXT N_( \
"Create video buffers in system memory instead of video memory. This " \ "Create video buffers in system memory instead of video memory. This " \
"isn't recommended as usually using video memory allows to benefit from " \ "isn't recommended as usually using video memory allows to benefit from " \
...@@ -56,9 +56,8 @@ void _M( vout_getfunctions )( function_list_t * p_function_list ); ...@@ -56,9 +56,8 @@ void _M( vout_getfunctions )( function_list_t * p_function_list );
MODULE_CONFIG_START MODULE_CONFIG_START
ADD_CATEGORY_HINT( N_("Video"), NULL ) ADD_CATEGORY_HINT( N_("Video"), NULL )
ADD_BOOL ( "no-directx-hw-yuv", NULL, HW_YUV_TEXT, HW_YUV_LONGTEXT ) ADD_BOOL ( "directx-hw-yuv", 1, NULL, HW_YUV_TEXT, HW_YUV_LONGTEXT )
ADD_BOOL ( "directx-use-sysmem", NULL, SYSMEM_TEXT, SYSMEM_LONGTEXT ) ADD_BOOL ( "directx-use-sysmem", 0, NULL, SYSMEM_TEXT, SYSMEM_LONGTEXT )
ADD_CATEGORY_HINT( N_("Audio"), NULL )
MODULE_CONFIG_STOP MODULE_CONFIG_STOP
MODULE_INIT_START MODULE_INIT_START
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* vout_directx.c: Windows DirectX video output display method * vout_directx.c: Windows DirectX video output display method
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: vout_directx.c,v 1.35 2002/05/18 22:41:43 gbazin Exp $ * $Id: vout_directx.c,v 1.36 2002/05/30 08:17:04 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -128,9 +128,9 @@ static int vout_Create( vout_thread_t *p_vout ) ...@@ -128,9 +128,9 @@ static int vout_Create( vout_thread_t *p_vout )
p_vout->p_sys->b_event_thread_die = 0; p_vout->p_sys->b_event_thread_die = 0;
p_vout->p_sys->b_caps_overlay_clipping = 0; p_vout->p_sys->b_caps_overlay_clipping = 0;
SetRectEmpty( &p_vout->p_sys->rect_display ); SetRectEmpty( &p_vout->p_sys->rect_display );
p_vout->p_sys->b_using_overlay = !config_GetIntVariable( "nooverlay" ); p_vout->p_sys->b_using_overlay = config_GetIntVariable( "overlay" );
p_vout->p_sys->b_use_sysmem = config_GetIntVariable( "directx-use-sysmem"); p_vout->p_sys->b_use_sysmem = config_GetIntVariable( "directx-use-sysmem");
p_vout->p_sys->b_hw_yuv = !config_GetIntVariable( "no-directx-hw-yuv" ); p_vout->p_sys->b_hw_yuv = config_GetIntVariable( "directx-hw-yuv" );
p_vout->p_sys->b_cursor_hidden = 0; p_vout->p_sys->b_cursor_hidden = 0;
p_vout->p_sys->i_lastmoved = mdate(); p_vout->p_sys->i_lastmoved = mdate();
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* wall.c : Wall video plugin for vlc * wall.c : Wall video plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: wall.c,v 1.19 2002/05/28 22:49:25 sam Exp $ * $Id: wall.c,v 1.20 2002/05/30 08:17:04 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -153,7 +153,6 @@ static int vout_Create( vout_thread_t *p_vout ) ...@@ -153,7 +153,6 @@ static int vout_Create( vout_thread_t *p_vout )
if( p_vout->p_sys->pp_vout == NULL ) if( p_vout->p_sys->pp_vout == NULL )
{ {
intf_ErrMsg("error: %s", strerror(ENOMEM) ); intf_ErrMsg("error: %s", strerror(ENOMEM) );
free( psz_method_tmp );
free( p_vout->p_sys ); free( p_vout->p_sys );
return( 1 ); return( 1 );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gnome.c : Gnome plugin for vlc * gnome.c : Gnome plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000 VideoLAN * Copyright (C) 2000 VideoLAN
* $Id: gnome.c,v 1.21 2002/05/22 14:20:41 gbazin Exp $ * $Id: gnome.c,v 1.22 2002/05/30 08:17:04 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -61,10 +61,11 @@ static gint GnomeManage ( gpointer p_data ); ...@@ -61,10 +61,11 @@ static gint GnomeManage ( gpointer p_data );
/***************************************************************************** /*****************************************************************************
* Building configuration tree * Building configuration tree
*****************************************************************************/ *****************************************************************************/
#define TOOLTIPS_TEXT N_("hide tooltips") #define TOOLTIPS_TEXT N_("show tooltips")
#define TOOLTIPS_LONGTEXT N_("Do not show tooltips for configuration options.") #define TOOLTIPS_LONGTEXT N_("Show tooltips for configuration options.")
#define TOOLBAR_TEXT N_("hide text on toolbar buttons")
#define TOOLBAR_LONGTEXT N_("Do not show the text below icons on the toolbar.") #define TOOLBAR_TEXT N_("show text on toolbar buttons")
#define TOOLBAR_LONGTEXT N_("Show the text below icons on the toolbar.")
#define PREFS_MAXH_TEXT N_("maximum height for the configuration windows") #define PREFS_MAXH_TEXT N_("maximum height for the configuration windows")
#define PREFS_MAXH_LONGTEXT N_( \ #define PREFS_MAXH_LONGTEXT N_( \
...@@ -72,13 +73,13 @@ static gint GnomeManage ( gpointer p_data ); ...@@ -72,13 +73,13 @@ static gint GnomeManage ( gpointer p_data );
"preferences menu will occupy.") "preferences menu will occupy.")
MODULE_CONFIG_START MODULE_CONFIG_START
ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL )
ADD_BOOL ( "gnome-notooltips", GtkHideTooltips, TOOLTIPS_TEXT, ADD_BOOL ( "gnome-tooltips", 1, GtkHideTooltips, TOOLTIPS_TEXT,
TOOLTIPS_LONGTEXT ) TOOLTIPS_LONGTEXT )
ADD_BOOL ( "gnome-notoolbartext", GtkHideToolbarText, TOOLBAR_TEXT, ADD_BOOL ( "gnome-toolbartext", GtkHideToolbarText, TOOLBAR_TEXT,
TOOLBAR_LONGTEXT ) TOOLBAR_LONGTEXT )
ADD_INTEGER ( "gnome-prefs-maxh", 480, NULL, PREFS_MAXH_TEXT, ADD_INTEGER( "gnome-prefs-maxh", 480, NULL, PREFS_MAXH_TEXT,
PREFS_MAXH_LONGTEXT ) PREFS_MAXH_LONGTEXT )
MODULE_CONFIG_STOP MODULE_CONFIG_STOP
MODULE_INIT_START MODULE_INIT_START
...@@ -272,11 +273,11 @@ static void intf_Run( intf_thread_t *p_intf ) ...@@ -272,11 +273,11 @@ static void intf_Run( intf_thread_t *p_intf )
p_intf->p_sys->p_tooltips = gtk_tooltips_new(); p_intf->p_sys->p_tooltips = gtk_tooltips_new();
/* Hide tooltips if the option is set */ /* Hide tooltips if the option is set */
if( config_GetIntVariable( "gnome-notooltips" ) ) if( !config_GetIntVariable( "gnome-tooltips" ) )
gtk_tooltips_disable( p_intf->p_sys->p_tooltips ); gtk_tooltips_disable( p_intf->p_sys->p_tooltips );
/* Hide toolbar text of the option is set */ /* Hide toolbar text of the option is set */
if ( config_GetIntVariable( "gnome-notoolbartext" ) ) if( !config_GetIntVariable( "gnome-toolbartext" ) )
gtk_toolbar_set_style( gtk_toolbar_set_style(
GTK_TOOLBAR(lookup_widget( p_intf->p_sys->p_window, "toolbar" )), GTK_TOOLBAR(lookup_widget( p_intf->p_sys->p_window, "toolbar" )),
GTK_TOOLBAR_ICONS ); GTK_TOOLBAR_ICONS );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk.c : Gtk+ plugin for vlc * gtk.c : Gtk+ plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: gtk.c,v 1.22 2002/05/20 22:39:36 sam Exp $ * $Id: gtk.c,v 1.23 2002/05/30 08:17:04 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -62,8 +62,8 @@ static gint GtkManage ( gpointer p_data ); ...@@ -62,8 +62,8 @@ static gint GtkManage ( gpointer p_data );
/***************************************************************************** /*****************************************************************************
* Building configuration tree * Building configuration tree
*****************************************************************************/ *****************************************************************************/
#define TOOLTIPS_TEXT N_("hide tooltips") #define TOOLTIPS_TEXT N_("show tooltips")
#define TOOLTIPS_LONGTEXT N_("Do not show tooltips for configuration options.") #define TOOLTIPS_LONGTEXT N_("Show tooltips for configuration options.")
#define PREFS_MAXH_TEXT N_("maximum height for the configuration windows") #define PREFS_MAXH_TEXT N_("maximum height for the configuration windows")
#define PREFS_MAXH_LONGTEXT N_( \ #define PREFS_MAXH_LONGTEXT N_( \
...@@ -71,11 +71,9 @@ static gint GtkManage ( gpointer p_data ); ...@@ -71,11 +71,9 @@ static gint GtkManage ( gpointer p_data );
"preferences menu will occupy.") "preferences menu will occupy.")
MODULE_CONFIG_START MODULE_CONFIG_START
ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL )
ADD_BOOL ( "gtk-notooltips", GtkHideTooltips, TOOLTIPS_TEXT, ADD_BOOL( "gtk-tooltips", 1, GtkHideTooltips, TOOLTIPS_TEXT, TOOLTIPS_LONGTEXT)
TOOLTIPS_LONGTEXT ) ADD_INTEGER( "gtk-prefs-maxh", 480, NULL, PREFS_MAXH_TEXT, PREFS_MAXH_LONGTEXT)
ADD_INTEGER ( "gtk-prefs-maxh", 480, NULL, PREFS_MAXH_TEXT,
PREFS_MAXH_LONGTEXT )
MODULE_CONFIG_STOP MODULE_CONFIG_STOP
MODULE_INIT_START MODULE_INIT_START
...@@ -271,7 +269,7 @@ static void intf_Run( intf_thread_t *p_intf ) ...@@ -271,7 +269,7 @@ static void intf_Run( intf_thread_t *p_intf )
p_intf->p_sys->p_jump = NULL; p_intf->p_sys->p_jump = NULL;
/* Hide tooltips if the option is set */ /* Hide tooltips if the option is set */
if( config_GetIntVariable( "gtk-notooltips" ) ) if( !config_GetIntVariable( "gtk-tooltips" ) )
gtk_tooltips_disable( p_intf->p_sys->p_tooltips ); gtk_tooltips_disable( p_intf->p_sys->p_tooltips );
/* Store p_intf to keep an eye on it */ /* Store p_intf to keep an eye on it */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* gtk_display.c: Gtk+ tools for main interface * gtk_display.c: Gtk+ tools for main interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: gtk_display.c,v 1.21 2002/05/04 02:05:03 lool Exp $ * $Id: gtk_display.c,v 1.22 2002/05/30 08:17:04 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -244,13 +244,13 @@ gint GtkModeManage( intf_thread_t * p_intf ) ...@@ -244,13 +244,13 @@ gint GtkModeManage( intf_thread_t * p_intf )
/***************************************************************************** /*****************************************************************************
* GtkHideTooltips: show or hide the tooltips depending on the configuration * GtkHideTooltips: show or hide the tooltips depending on the configuration
* option gnome-notooltips * option gnome-tooltips
***************************************************************************** *****************************************************************************
* FIXME: we should get the intf as parameter * FIXME: we should get the intf as parameter
*****************************************************************************/ *****************************************************************************/
void GtkHideTooltips( void ) void GtkHideTooltips( void )
{ {
if( config_GetIntVariable( "gnome-notooltips" ) ) if( !config_GetIntVariable( "gnome-tooltips" ) )
gtk_tooltips_disable( p_main->p_intf->p_sys->p_tooltips ); gtk_tooltips_disable( p_main->p_intf->p_sys->p_tooltips );
else gtk_tooltips_enable( p_main->p_intf->p_sys->p_tooltips ); else gtk_tooltips_enable( p_main->p_intf->p_sys->p_tooltips );
} }
...@@ -258,7 +258,7 @@ void GtkHideTooltips( void ) ...@@ -258,7 +258,7 @@ void GtkHideTooltips( void )
#ifdef MODULE_NAME_IS_gnome #ifdef MODULE_NAME_IS_gnome
/***************************************************************************** /*****************************************************************************
* GtkHideToolbartext: show or hide the tooltips depending on the * GtkHideToolbartext: show or hide the tooltips depending on the
* configuration option gnome-notoolbartext * configuration option gnome-toolbartext
***************************************************************************** *****************************************************************************
* FIXME: we should get the intf as parameter * FIXME: we should get the intf as parameter
* FIXME: GNOME only because of missing icons in gtk interface * FIXME: GNOME only because of missing icons in gtk interface
...@@ -268,9 +268,9 @@ void GtkHideToolbarText( void ) ...@@ -268,9 +268,9 @@ void GtkHideToolbarText( void )
GtkToolbarStyle style; GtkToolbarStyle style;
GtkToolbar * p_toolbar; GtkToolbar * p_toolbar;
style = config_GetIntVariable( "gnome-notoolbartext" ) style = config_GetIntVariable( "gnome-toolbartext" )
? GTK_TOOLBAR_ICONS ? GTK_TOOLBAR_BOTH
: GTK_TOOLBAR_BOTH; : GTK_TOOLBAR_ICONS;
p_toolbar = GTK_TOOLBAR(lookup_widget( p_main->p_intf->p_sys->p_window, p_toolbar = GTK_TOOLBAR(lookup_widget( p_main->p_intf->p_sys->p_window,
"toolbar" )); "toolbar" ));
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* xmga.c : X11 MGA plugin for vlc * xmga.c : X11 MGA plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: xmga.c,v 1.14 2002/05/18 17:47:47 sam Exp $ * $Id: xmga.c,v 1.15 2002/05/30 08:17:04 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -110,7 +110,7 @@ static void ToggleCursor ( vout_thread_t * ); ...@@ -110,7 +110,7 @@ static void ToggleCursor ( vout_thread_t * );
MODULE_CONFIG_START MODULE_CONFIG_START
ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL )
ADD_STRING ( "xmga_display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT ) ADD_STRING ( "xmga_display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT )
ADD_BOOL ( "xmga_altfullscreen", NULL, ALT_FS_TEXT, ALT_FS_LONGTEXT ) ADD_BOOL ( "xmga_altfullscreen", 0, NULL, ALT_FS_TEXT, ALT_FS_LONGTEXT )
MODULE_CONFIG_STOP MODULE_CONFIG_STOP
MODULE_INIT_START MODULE_INIT_START
......
...@@ -172,8 +172,8 @@ static int vout_Create( vout_thread_t *p_vout ) ...@@ -172,8 +172,8 @@ static int vout_Create( vout_thread_t *p_vout )
p_vout->b_fullscreen = p_vout->b_fullscreen =
config_GetIntVariable( "fullscreen" ); config_GetIntVariable( "fullscreen" );
p_vout->p_sys->i_mode = p_vout->p_sys->i_mode =
config_GetIntVariable( "nooverlay" ) ? config_GetIntVariable( "overlay" ) ?
MODE_NORMAL_MEM : MODE_VIDEO_OVERLAY; MODE_NORMAL_OVERLAY : MODE_VIDEO_MEM;
p_vout->p_sys->dim.w = p_vout->i_window_width; p_vout->p_sys->dim.w = p_vout->i_window_width;
p_vout->p_sys->dim.h = p_vout->i_window_height; p_vout->p_sys->dim.h = p_vout->i_window_height;
......
...@@ -68,7 +68,7 @@ MODULE_CONFIG_START ...@@ -68,7 +68,7 @@ MODULE_CONFIG_START
ADD_INTEGER ( "polarization", 0, NULL, POL_TEXT, POL_LONGTEXT ) ADD_INTEGER ( "polarization", 0, NULL, POL_TEXT, POL_LONGTEXT )
ADD_INTEGER ( "fec", 3, NULL, FEC_TEXT, FEC_LONGTEXT ) ADD_INTEGER ( "fec", 3, NULL, FEC_TEXT, FEC_LONGTEXT )
ADD_INTEGER ( "symbol-rate", 27500, NULL, SRATE_TEXT, SRATE_LONGTEXT ) ADD_INTEGER ( "symbol-rate", 27500, NULL, SRATE_TEXT, SRATE_LONGTEXT )
ADD_BOOL ( "diseqc", 0, DISEQC_TEXT, DISEQC_LONGTEXT ) ADD_BOOL ( "diseqc", 0, NULL, DISEQC_TEXT, DISEQC_LONGTEXT )
ADD_INTEGER ( "lnb-lof1", 10000, NULL, LNB_LOF1_TEXT, LNB_LOF1_LONGTEXT ) ADD_INTEGER ( "lnb-lof1", 10000, NULL, LNB_LOF1_TEXT, LNB_LOF1_LONGTEXT )
ADD_INTEGER ( "lnb-lof2", 10000, NULL, LNB_LOF2_TEXT, LNB_LOF2_LONGTEXT ) ADD_INTEGER ( "lnb-lof2", 10000, NULL, LNB_LOF2_TEXT, LNB_LOF2_LONGTEXT )
ADD_INTEGER ( "lnb-slof", 11700, NULL, LNB_SLOF_TEXT, LNB_SLOF_LONGTEXT ) ADD_INTEGER ( "lnb-slof", 11700, NULL, LNB_SLOF_TEXT, LNB_SLOF_LONGTEXT )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* x11.c : X11 plugin for vlc * x11.c : X11 plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: x11.c,v 1.16 2002/04/23 14:16:20 sam Exp $ * $Id: x11.c,v 1.17 2002/05/30 08:17:04 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
MODULE_CONFIG_START MODULE_CONFIG_START
ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL )
ADD_STRING ( "x11-display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT ) ADD_STRING ( "x11-display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT )
ADD_BOOL ( "x11-altfullscreen", NULL, ALT_FS_TEXT, ALT_FS_LONGTEXT ) ADD_BOOL ( "x11-altfullscreen", 0, NULL, ALT_FS_TEXT, ALT_FS_LONGTEXT )
MODULE_CONFIG_STOP MODULE_CONFIG_STOP
MODULE_INIT_START MODULE_INIT_START
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* xvideo.c : Xvideo plugin for vlc * xvideo.c : Xvideo plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001 VideoLAN
* $Id: xvideo.c,v 1.12 2002/05/13 17:58:08 sam Exp $ * $Id: xvideo.c,v 1.13 2002/05/30 08:17:04 gbazin Exp $
* *
* Authors: Shane Harper <shanegh@optusnet.com.au> * Authors: Shane Harper <shanegh@optusnet.com.au>
* Vincent Seguin <seguin@via.ecp.fr> * Vincent Seguin <seguin@via.ecp.fr>
...@@ -65,7 +65,7 @@ MODULE_CONFIG_START ...@@ -65,7 +65,7 @@ MODULE_CONFIG_START
ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL )
ADD_STRING ( "xvideo-display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT ) ADD_STRING ( "xvideo-display", NULL, NULL, DISPLAY_TEXT, DISPLAY_LONGTEXT )
ADD_INTEGER ( "xvideo-adaptor", -1, NULL, ADAPTOR_TEXT, ADAPTOR_LONGTEXT ) ADD_INTEGER ( "xvideo-adaptor", -1, NULL, ADAPTOR_TEXT, ADAPTOR_LONGTEXT )
ADD_BOOL ( "xvideo-altfullscreen", NULL, ALT_FS_TEXT, ALT_FS_LONGTEXT ) ADD_BOOL ( "xvideo-altfullscreen", 0, NULL, ALT_FS_TEXT, ALT_FS_LONGTEXT )
ADD_STRING ( "xvideo-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT ) ADD_STRING ( "xvideo-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT )
MODULE_CONFIG_STOP MODULE_CONFIG_STOP
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* configuration.c management of the modules configuration * configuration.c management of the modules configuration
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: configuration.c,v 1.25 2002/05/18 17:53:11 massiot Exp $ * $Id: configuration.c,v 1.26 2002/05/30 08:17:04 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -775,7 +775,7 @@ int config_SaveConfigFile( const char *psz_module_name ) ...@@ -775,7 +775,7 @@ int config_SaveConfigFile( const char *psz_module_name )
int config_LoadCmdLine( int *pi_argc, char *ppsz_argv[], int config_LoadCmdLine( int *pi_argc, char *ppsz_argv[],
boolean_t b_ignore_errors ) boolean_t b_ignore_errors )
{ {
int i_cmd, i_index, i_opts, i_shortopts; int i_cmd, i_index, i_opts, i_shortopts, flag;
module_t *p_module; module_t *p_module;
module_config_t *p_item; module_config_t *p_item;
struct option *p_longopts; struct option *p_longopts;
...@@ -823,8 +823,9 @@ int config_LoadCmdLine( int *pi_argc, char *ppsz_argv[], ...@@ -823,8 +823,9 @@ int config_LoadCmdLine( int *pi_argc, char *ppsz_argv[],
p_module = p_module->next ) p_module = p_module->next )
{ {
/* count the number of exported configuration options (to allocate /* count the number of exported configuration options (to allocate
* longopts). */ * longopts). We also need to allocate space for too options when
i_opts += p_module->i_config_items; * dealing with boolean to allow for --foo and --no-foo */
i_opts += (p_module->i_config_items + p_module->i_bool_items);
} }
p_longopts = malloc( sizeof(struct option) * (i_opts + 1) ); p_longopts = malloc( sizeof(struct option) * (i_opts + 1) );
...@@ -880,14 +881,31 @@ int config_LoadCmdLine( int *pi_argc, char *ppsz_argv[], ...@@ -880,14 +881,31 @@ int config_LoadCmdLine( int *pi_argc, char *ppsz_argv[],
continue; continue;
/* Add item to long options */ /* Add item to long options */
p_longopts[i_index].name = p_item->psz_name; p_longopts[i_index].name = strdup( p_item->psz_name );
if( p_longopts[i_index].name == NULL ) continue;
p_longopts[i_index].has_arg = p_longopts[i_index].has_arg =
(p_item->i_type == MODULE_CONFIG_ITEM_BOOL)? (p_item->i_type == MODULE_CONFIG_ITEM_BOOL)?
no_argument : required_argument; no_argument : required_argument;
p_longopts[i_index].flag = 0; p_longopts[i_index].flag = &flag;
p_longopts[i_index].val = 0; p_longopts[i_index].val = 0;
i_index++; i_index++;
/* When dealing with bools we also need to add the --no-foo
* option */
if( p_item->i_type == MODULE_CONFIG_ITEM_BOOL )
{
char *psz_name = malloc( strlen(p_item->psz_name) + 4 );
if( psz_name == NULL ) continue;
strcpy( psz_name, "no-" );
strcat( psz_name, p_item->psz_name );
p_longopts[i_index].name = psz_name;
p_longopts[i_index].has_arg = no_argument;
p_longopts[i_index].flag = &flag;
p_longopts[i_index].val = 1;
i_index++;
}
/* If item also has a short option, add it */ /* If item also has a short option, add it */
if( p_item->i_short ) if( p_item->i_short )
{ {
...@@ -919,26 +937,29 @@ int config_LoadCmdLine( int *pi_argc, char *ppsz_argv[], ...@@ -919,26 +937,29 @@ int config_LoadCmdLine( int *pi_argc, char *ppsz_argv[],
if( i_cmd == 0 ) if( i_cmd == 0 )
{ {
module_config_t *p_conf; module_config_t *p_conf;
char *psz_name = (char *)p_longopts[i_index].name;
/* Check if we deal with a --no-foo long option */
if( flag ) psz_name += 3;
/* Store the configuration option */ /* Store the configuration option */
p_conf = config_FindConfig( p_longopts[i_index].name ); p_conf = config_FindConfig( psz_name );
switch( p_conf->i_type ) if( p_conf ) switch( p_conf->i_type )
{ {
case MODULE_CONFIG_ITEM_STRING: case MODULE_CONFIG_ITEM_STRING:
case MODULE_CONFIG_ITEM_FILE: case MODULE_CONFIG_ITEM_FILE:
case MODULE_CONFIG_ITEM_MODULE: case MODULE_CONFIG_ITEM_MODULE:
config_PutPszVariable( p_longopts[i_index].name, optarg ); config_PutPszVariable( psz_name, optarg );
break; break;
case MODULE_CONFIG_ITEM_INTEGER: case MODULE_CONFIG_ITEM_INTEGER:
config_PutIntVariable( p_longopts[i_index].name, atoi(optarg)); config_PutIntVariable( psz_name, atoi(optarg));
break; break;
case MODULE_CONFIG_ITEM_FLOAT: case MODULE_CONFIG_ITEM_FLOAT:
config_PutFloatVariable( p_longopts[i_index].name, config_PutFloatVariable( psz_name, (float)atof(optarg) );
(float)atof(optarg) );
break; break;
case MODULE_CONFIG_ITEM_BOOL: case MODULE_CONFIG_ITEM_BOOL:
config_PutIntVariable( p_longopts[i_index].name, 1 ); config_PutIntVariable( psz_name, !flag );
break; break;
} }
...@@ -989,6 +1010,9 @@ int config_LoadCmdLine( int *pi_argc, char *ppsz_argv[], ...@@ -989,6 +1010,9 @@ int config_LoadCmdLine( int *pi_argc, char *ppsz_argv[],
} }
} }
/* Free allocated resources */
for( i_index = 0; p_longopts[i_index].name; i_index++ )
free( (char *)p_longopts[i_index].name );
free( p_longopts ); free( p_longopts );
free( psz_shortopts ); free( psz_shortopts );
if( b_ignore_errors ) free( ppsz_argv ); if( b_ignore_errors ) free( ppsz_argv );
......
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