Commit c28682f6 authored by Gildas Bazin's avatar Gildas Bazin

* include/vlc_help.h src/libvlc.h: thou shalt not hardcode newlines in the middle of sentences.
* src/extras/libc.c, include/vlc_common.h: resuscitated vlc_wraptext() and added utf8 support.
* modules/gui/wxwindows/preferences.cpp: use vlc_wraptext() for capabilities help.
parent 52f2126b
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.80 2003/09/21 10:23:59 gbazin Exp $
* $Id: vlc_common.h,v 1.81 2003/10/08 19:40:42 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -281,6 +281,10 @@ typedef struct decoder_fifo_t decoder_fifo_t;
typedef struct decoder_t decoder_t;
typedef struct decoder_sys_t decoder_sys_t;
/* Encoders */
typedef struct encoder_t encoder_t;
typedef struct encoder_sys_t encoder_sys_t;
/* Misc */
typedef struct data_packet_t data_packet_t;
typedef struct data_buffer_t data_buffer_t;
......@@ -764,6 +768,10 @@ typedef __int64 off_t;
# define vlc_lseek NULL
#endif
/* vlc_wraptext (defined in src/extras/libc.c) */
#define wraptext vlc_wraptext
VLC_EXPORT( char *, vlc_wraptext, ( const char *, int, vlc_bool_t ) );
/*****************************************************************************
* CPU capabilities
*****************************************************************************/
......@@ -795,7 +803,7 @@ VLC_EXPORT( char *, vlc_dgettext, ( const char *package, const char *msgid ) );
#endif
# undef _
#if defined( __BORLANDC__ )
#define _(String) vlc_dgettext (PACKAGE_TARNAME, String)
#define _(String) vlc_dgettext (PACKAGE_TARNAME, String)
#else
# define _(String) vlc_dgettext (PACKAGE, String)
#endif
......
......@@ -2,7 +2,7 @@
* vlc_help.h: Help strings
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: vlc_help.h,v 1.2 2003/10/05 09:27:45 zorglub Exp $
* $Id: vlc_help.h,v 1.3 2003/10/08 19:40:42 gbazin Exp $
*
* Authors: Clément Stenac <zorglub@videolan.org>
* Anil Daoud <anil@videolan.org>
......@@ -31,8 +31,8 @@
*/
#define GENERAL_TITLE N_( "VLC Preferences" )
#define GENERAL_HELP N_( \
"Configure some global options in General Settings" \
"\n and configure each VLC plugin in the Plugins section.\n" \
"Configure some global options in General Settings " \
"and configure each VLC plugin in the Plugins section.\n" \
"Click on 'Advanced Options' to see every options." )
#define PLUGIN_TITLE N_( "VLC Plugins Preferences" )
......@@ -46,59 +46,59 @@
#define ACCESS_TITLE N_( "Access modules settings" )
#define ACCESS_HELP N_( \
"Settings related to the various access methods used by VLC\n" \
"Common settings you may want to alter are http proxy or\n" \
"caching settings" )
"Settings related to the various access methods used by VLC.\n" \
"Common settings you may want to alter are http proxy or " \
"caching settings." )
#define AUDIO_FILTER_TITLE N_("Audio filters settings")
#define AUDIO_FILTER_HELP N_( \
"Audio filters can be set in the Audio section, and configured\n" \
"Audio filters can be set in the Audio section, and configured " \
"here.")
#define AOUT_TITLE N_("Audio output modules settings")
#define AOUT_HELP N_("These are general settings for audio output modules")
#define AOUT_HELP N_("These are general settings for audio output modules.")
#define CHROMA_TITLE N_("Chroma modules settings")
#define CHROMA_HELP N_(" ")
#define DECODER_TITLE N_("Decoder modules settings" )
#define DECODER_HELP N_( \
"In the Subsdec section you may want to set your preferred subtitles\n" \
"text encoding\n")
"In the Subsdec section you may want to set your preferred subtitles " \
"text encoding.")
#define DEMUX_TITLE N_("Demuxers settings")
#define DEMUX_HELP N_( " ")
#define INTERFACE_TITLE N_("Interface plugins settings")
#define INTERFACE_HELP N_( \
"Interface plugins can be enabled in the Interface section and\n" \
"Interface plugins can be enabled in the Interface section and " \
"configured here.")
#define SOUT_TITLE N_("Stream output access modules settings")
#define SOUT_HELP N_( \
"In this section you can set the caching value for the UDP stream\n" \
"output access module")
"In this section you can set the caching value for the UDP stream" \
"output access module.")
#define SUBTITLE_DEMUX_TITLE N_("Subtitle demuxer settings")
#define SUBTITLE_DEMUX_HELP N_( \
"In this section you can force the behaviour of the subtitle demuxer,\n" \
"In this section you can force the behaviour of the subtitle demuxer, " \
"for example by setting the subtitles type or file name.")
#define TEXT_TITLE N_("Text renderer settings")
#define TEXT_HELP N_( \
"Use these settings to choose the font you want VLC to use for text\n" \
"rendering (to display subtitles for example)")
"Use these settings to choose the font you want VLC to use for text " \
"rendering (to display subtitles for example).")
#define VOUT__TITLE N_("Video output modules settings")
#define VOUT_HELP N_( \
"Choose your preferred video output in the Video section, \n" \
"Choose your preferred video output in the Video section, " \
"and configure it here." )
#define VIDEO_FILTER_TITLE N_("Video filters settings")
#define VIDEO_FILTER_HELP N_( \
"Video filters can be enabled in the Video section and configured " \
"here.\n" \
"Configure the \"adjust\" filter to modify contrast/hue/saturation \n" \
"Configure the \"adjust\" filter to modify contrast/hue/saturation " \
" settings.")
/*
......
......@@ -2,7 +2,7 @@
* preferences.cpp : wxWindows plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: preferences.cpp,v 1.33 2003/10/05 09:27:46 zorglub Exp $
* $Id: preferences.cpp,v 1.34 2003/10/08 19:40:42 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -344,38 +344,34 @@ void PrefsDialog::OnAdvanced( wxCommandEvent& event )
*****************************************************************************/
static char * GetCapabilityHelp( char *psz_capability, int i_type)
{
if( psz_capability == NULL)
return NULL;
if( psz_capability == NULL) return "";
if( !strcasecmp(psz_capability,"access") )
return i_type == 1 ? strdup(ACCESS_TITLE) : strdup(ACCESS_HELP);
return i_type == 1 ? ACCESS_TITLE : ACCESS_HELP;
if( !strcasecmp(psz_capability,"audio filter") )
return i_type == 1 ? strdup(AUDIO_FILTER_TITLE) :
strdup(AUDIO_FILTER_HELP);
return i_type == 1 ? AUDIO_FILTER_TITLE : AUDIO_FILTER_HELP;
if( !strcasecmp(psz_capability,"audio output") )
return i_type == 1 ? strdup(AOUT_TITLE) : strdup(AOUT_HELP);
return i_type == 1 ? AOUT_TITLE : AOUT_HELP;
if( !strcasecmp(psz_capability,"chroma") )
return i_type == 1 ? strdup(CHROMA_TITLE) : strdup(CHROMA_HELP);
return i_type == 1 ? CHROMA_TITLE : CHROMA_HELP;
if( !strcasecmp(psz_capability,"decoder") )
return i_type == 1 ? strdup(DECODER_TITLE) : strdup(DECODER_HELP);
return i_type == 1 ? DECODER_TITLE : DECODER_HELP;
if( !strcasecmp(psz_capability,"demux") )
return i_type == 1 ? strdup(DEMUX_TITLE) : strdup(DEMUX_HELP);
return i_type == 1 ? DEMUX_TITLE : DEMUX_HELP;
if( !strcasecmp(psz_capability,"interface") )
return i_type == 1 ? strdup(INTERFACE_TITLE) : strdup(INTERFACE_HELP);
return i_type == 1 ? INTERFACE_TITLE : INTERFACE_HELP;
if( !strcasecmp(psz_capability,"sout access") )
return i_type == 1 ? strdup(SOUT_TITLE) : strdup(SOUT_HELP);
return i_type == 1 ? SOUT_TITLE : SOUT_HELP;
if( !strcasecmp(psz_capability,"subtitle demux") )
return i_type == 1 ? strdup(SUBTITLE_DEMUX_TITLE) :
strdup(SUBTITLE_DEMUX_HELP);
return i_type == 1 ? SUBTITLE_DEMUX_TITLE : SUBTITLE_DEMUX_HELP;
if( !strcasecmp(psz_capability,"text renderer") )
return i_type == 1 ? strdup(TEXT_TITLE) : strdup(TEXT_HELP);
return i_type == 1 ? TEXT_TITLE : TEXT_HELP;
if( !strcasecmp(psz_capability,"video output") )
return i_type == 1 ? strdup(VOUT__TITLE) : strdup(VOUT_HELP);
return i_type == 1 ? VOUT__TITLE : VOUT_HELP;
if( !strcasecmp(psz_capability,"video filter") )
return i_type == 1 ? strdup(VIDEO_FILTER_TITLE) :
strdup(VIDEO_FILTER_HELP);
return i_type == 1 ? VIDEO_FILTER_TITLE : VIDEO_FILTER_HELP;
return i_type == 1 ? strdup(UNKNOWN_TITLE) : strdup(UNKNOWN_HELP);
return "";
}
/*****************************************************************************
......@@ -413,7 +409,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
ConfigTreeData *config_data = new ConfigTreeData;
config_data->psz_section = NULL;
config_data->i_object_id = GENERAL_ID;
config_data->psz_help = strdup( GENERAL_HELP );
config_data->psz_help = wraptext( GENERAL_HELP, WRAPCOUNT, ISUTF8 );
config_data->psz_section = strdup( GENERAL_TITLE );
general_item = AppendItem( root_item, wxU(_("General Settings")),
-1, -1, config_data );
......@@ -441,7 +437,8 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
config_data->psz_section = strdup(p_item->psz_text);
if( p_item->psz_longtext )
{
config_data->psz_help = strdup( p_item->psz_longtext);
config_data->psz_help =
wraptext( p_item->psz_longtext, WRAPCOUNT, ISUTF8 );
}
else
{
......@@ -467,7 +464,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
config_data = new ConfigTreeData;
config_data->psz_section = NULL;
config_data->i_object_id = PLUGIN_ID;
config_data->psz_help = strdup( PLUGIN_HELP );
config_data->psz_help = wraptext( PLUGIN_HELP, WRAPCOUNT, ISUTF8 );
config_data->psz_section = strdup( PLUGIN_TITLE );
plugins_item = AppendItem( root_item, wxU(_("Plugins")),
-1,-1,config_data );
......@@ -517,9 +514,11 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
/* We didn't find it, add it */
ConfigTreeData *config_data = new ConfigTreeData;
config_data->psz_section =
GetCapabilityHelp( p_module->psz_capability , 1 );
wraptext( GetCapabilityHelp( p_module->psz_capability , 1 ),
WRAPCOUNT, ISUTF8 );
config_data->psz_help =
GetCapabilityHelp( p_module->psz_capability , 2 );
wraptext( GetCapabilityHelp( p_module->psz_capability , 2 ),
WRAPCOUNT, ISUTF8 );
config_data->i_object_id = CAPABILITY_ID;
capability_item = AppendItem( plugins_item,
wxU(p_module->psz_capability),
......@@ -532,7 +531,7 @@ PrefsTreeCtrl::PrefsTreeCtrl( wxWindow *_p_parent, intf_thread_t *_p_intf,
config_data->i_object_id = p_module->b_submodule ?
((module_t *)p_module->p_parent)->i_object_id :
p_module->i_object_id;
config_data->psz_help = strdup( "" );
config_data->psz_help = NULL;
AppendItem( capability_item, wxU(p_module->psz_object_name), -1, -1,
config_data );
}
......@@ -735,7 +734,7 @@ void PrefsTreeCtrl::OnSelectTreeItem( wxTreeEvent& event )
new PrefsPanel( p_parent, p_intf, p_prefs_dialog,
config_data->i_object_id,
config_data->psz_section,
config_data->psz_help);
config_data->psz_help );
config_data->panel->SwitchAdvanced( b_advanced );
}
else
......@@ -805,12 +804,7 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
if( i_object_id == PLUGIN_ID || i_object_id == GENERAL_ID ||
i_object_id == CAPABILITY_ID )
{
/* Add a head title to the panel */
// msg_Dbg(p_intf,"%s : %s", psz_section, psz_help) ;
label = new wxStaticText( this, -1,wxU(_( psz_section )));
/* i_object_id == CAPABILITY_ID ?
GetCapabilityHelp( psz_section , 1 ):
psz_section ) ) );*/
wxFont heading_font = label->GetFont();
heading_font.SetPointSize( heading_font.GetPointSize() + 5 );
label->SetFont( heading_font );
......@@ -821,15 +815,6 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
help = new wxStaticText( this, -1, wxU(_( psz_help ) ) );
sizer->Add( help ,0 ,wxEXPAND | wxALL, 5 );
#if 0
wxStaticBox *static_box = new wxStaticBox( this, -1, wxT("") );
wxStaticBoxSizer *box_sizer = new wxStaticBoxSizer( static_box,
wxVERTICAL );
label = new wxStaticText( this, -1, wxU(_( psz_help) ) );
box_sizer->Add( label, 1, wxEXPAND | wxLEFT | wxRIGHT, 5 );
sizer->Add( box_sizer, 0, wxEXPAND | wxALL , 5 );
#endif
config_sizer = NULL; config_window = NULL;
}
else
......@@ -1084,7 +1069,7 @@ PrefsPanel::PrefsPanel( wxWindow* parent, intf_thread_t *_p_intf,
sizer->Add( config_window, 1, wxEXPAND | wxALL, 5 );
/* And at last put a useful help string if available */
if( psz_help && psz_help[1] )
if( psz_help && *psz_help )
{
sizer->Add( new wxStaticLine( this, 0 ), 0,
wxEXPAND | wxLEFT | wxRIGHT, 2 );
......
......@@ -2,7 +2,7 @@
* wxwindows.h: private wxWindows interface description
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: wxwindows.h,v 1.63 2003/10/06 16:23:30 zorglub Exp $
* $Id: wxwindows.h,v 1.64 2003/10/08 19:40:42 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -59,6 +59,7 @@ class FileInfo;
#else
# define wxU(utf8) wxString(wxConvUTF8.cMB2WC(utf8), *wxConvCurrent)
#endif
#define ISUTF8 1
#else // ENABLE_NLS && HAVE_GETTEXT && WIN32 && !HAVE_INCLUDED_GETTEXT
#if wxUSE_UNICODE
......@@ -66,9 +67,12 @@ class FileInfo;
#else
# define wxU(ansi) ansi
#endif
#define ISUTF8 0
#endif
#define WRAPCOUNT 80
wxArrayString SeparateEntries( wxString );
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* libc.c: Extra libc function for some systems.
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: libc.c,v 1.9 2003/08/14 11:47:31 gbazin Exp $
* $Id: libc.c,v 1.10 2003/10/08 19:40:42 gbazin Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Samuel Hocevar <sam@zoy.org>
......@@ -194,3 +194,89 @@ char *vlc_dgettext( const char *package, const char *msgid )
#endif
}
/*****************************************************************************
* count_utf8_string: returns the number of characters in the string.
*****************************************************************************/
static int count_utf8_string( const char *psz_string )
{
int i = 0, i_count = 0;
while( psz_string[ i ] != 0 )
{
if( ((unsigned char *)psz_string)[ i ] < 0x80UL ) i_count++;
i++;
}
return i_count;
}
/*****************************************************************************
* wraptext: inserts \n at convenient places to wrap the text.
* Returns the modified string in a new buffer.
*****************************************************************************/
char *vlc_wraptext( const char *psz_text, int i_line, vlc_bool_t b_utf8 )
{
int i_len;
char *psz_line, *psz_new_text;
psz_line = psz_new_text = strdup( psz_text );
if( b_utf8 )
i_len = count_utf8_string( psz_text );
else
i_len = strlen( psz_text );
while( i_len > i_line )
{
/* Look if there is a newline somewhere. */
char *psz_parser = psz_line;
int i_count = 0;
while( i_count <= i_line && *psz_parser != '\n' )
{
if( b_utf8 )
{
while( *((unsigned char *)psz_parser) >= 0x80UL ) psz_parser++;
}
psz_parser++;
i_count++;
}
if( *psz_parser == '\n' )
{
i_len -= (i_count + 1);
psz_line = psz_parser + 1;
continue;
}
/* Find the furthest space. */
while( psz_parser > psz_line && *psz_parser != ' ' )
{
if( b_utf8 )
{
while( *((unsigned char *)psz_parser) >= 0x80UL ) psz_parser--;
}
psz_parser--;
i_count--;
}
if( *psz_parser == ' ' )
{
*psz_parser = '\n';
i_len -= (i_count + 1);
psz_line = psz_parser + 1;
continue;
}
/* Wrapping has failed. Find the first space or newline */
while( i_count < i_len && *psz_parser != ' ' && *psz_parser != '\n' )
{
if( b_utf8 )
{
while( *((unsigned char *)psz_parser) >= 0x80UL ) psz_parser++;
}
psz_parser++;
i_count++;
}
if( i_count < i_len ) *psz_parser = '\n';
i_len -= (i_count + 1);
psz_line = psz_parser + 1;
}
return psz_new_text;
}
......@@ -2,7 +2,7 @@
* libvlc.h: main libvlc header
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.h,v 1.93 2003/10/03 23:31:43 sigmunau Exp $
* $Id: libvlc.h,v 1.94 2003/10/08 19:40:42 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -38,12 +38,12 @@ static char *ppsz_language[] = { "auto", "en", "en_GB", "de", "fr", "it", "ja",
#define INTF_CAT_LONGTEXT N_( \
"These options allow you to configure the interfaces used by VLC.\n" \
"You can select the main interface, additional\n" \
"You can select the main interface, additional " \
"interface modules, and define various related options." )
#define INTF_TEXT N_("Interface module")
#define INTF_LONGTEXT N_( \
"This option allows you to select the interface used by VLC. \n" \
"This option allows you to select the interface used by VLC.\n" \
"The default behavior is to automatically select the best module " \
"available.")
......@@ -90,10 +90,10 @@ static char *ppsz_language[] = { "auto", "en", "en_GB", "de", "fr", "it", "ja",
"for its plugins.")
#define AOUT_CAT_LONGTEXT N_( \
"These options allow you to tune VLC's audio subsystem, \n" \
"and to add audio filters which can be used for \n" \
"postprocessing or visual effects (spectrum analyser,...) \n" \
"To tune these filters, have a look at the \"audio filter\"\n" \
"These options allow you to tune VLC's audio subsystem, " \
"and to add audio filters which can be used for " \
"postprocessing or visual effects (spectrum analyser,...).\n" \
"To tune these filters, have a look at the \"audio filter\" " \
"plugin options.")
#define AOUT_TEXT N_("Audio output module")
......@@ -162,11 +162,11 @@ static char *ppsz_language[] = { "auto", "en", "en_GB", "de", "fr", "it", "ja",
"to 5.1.")
#define VOUT_CAT_LONGTEXT N_( \
"These options allow you to modify options related to \n" \
"the video output subsystem. You can for example enable \n" \
"video filters, like deinterlacing, constrast / hue / \n " \
"saturation adjusting, ... \n" \
"Enable these filters here and configure them in the video \n" \
"These options allow you to modify options related to " \
"the video output subsystem. You can for example enable " \
"video filters, like deinterlacing, constrast / hue / " \
"saturation adjusting, ...\n" \
"Enable these filters here and configure them in the video " \
"filters plugins section." )
#define VOUT_TEXT N_("Video output module")
......@@ -321,8 +321,8 @@ static char *ppsz_language[] = { "auto", "en", "en_GB", "de", "fr", "it", "ja",
"HTTP connections.")
#define CODEC_CAT_LONGTEXT N_( \
"This option can be used to alter the way VLC selects \n" \
"its codecs (decompression methods). Only advanced users should \n" \
"This option can be used to alter the way VLC selects " \
"its codecs (decompression methods). Only advanced users should " \
"alter this option as it can break playback of all your streams." )
#define CODEC_TEXT N_("Choose preferred codec list")
......@@ -345,7 +345,7 @@ static char *ppsz_language[] = { "auto", "en", "en_GB", "de", "fr", "it", "ja",
"codecs. " )
#define SOUT_CAT_LONGTEXT N_( \
"These options allow you to set default global options for the\n " \
"These options allow you to set default global options for the " \
"stream output subsystem." )
#define SOUT_TEXT N_("Choose a stream output")
......@@ -386,8 +386,8 @@ static char *ppsz_language[] = { "auto", "en", "en_GB", "de", "fr", "it", "ja",
"This is a legacy entry to let you configure access output modules")
#define CPU_CAT_LONGTEXT N_( \
"These options allow you to enable special CPU \n " \
"optimizations. You should always leave all these enabled." )
"These options allow you to enable special CPU optimizations.\n" \
"You should always leave all these enabled." )
#define MMX_TEXT N_("Enable CPU MMX support")
#define MMX_LONGTEXT N_( \
......@@ -415,7 +415,7 @@ static char *ppsz_language[] = { "auto", "en", "en_GB", "de", "fr", "it", "ja",
"advantage of them.")
#define PLAYLIST_CAT_LONGTEXT N_( \
"These options define the behaviour of the playlist. Some \n" \
"These options define the behaviour of the playlist. Some " \
"of them can be overriden in the playlist dialog box." )
#define RANDOM_TEXT N_("Play files randomly forever")
......@@ -434,7 +434,7 @@ static char *ppsz_language[] = { "auto", "en", "en_GB", "de", "fr", "it", "ja",
"over and over again.")
#define MISC_CAT_LONGTEXT N_( \
"These options allow you to select default modules. Leave these \n" \
"These options allow you to select default modules. Leave these " \
"alone unless you really know what you are doing." )
#define MEMCPY_TEXT N_("Memory copy module")
......
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