]> git.sesse.net Git - vlc/commitdiff
* src/extras/libc.c: New vlc_wraptext function,
authorChristophe Massiot <massiot@videolan.org>
Sat, 8 Feb 2003 22:20:28 +0000 (22:20 +0000)
committerChristophe Massiot <massiot@videolan.org>
Sat, 8 Feb 2003 22:20:28 +0000 (22:20 +0000)
* modules/gui/macosx/prefs.m: Wrap tool tips to 60 characters,
* src/input/input.c: Correctly parse MRL of the type
  /Volumes/toto:titi/coincoin.mpg (closes #238 & #186)
* modules/access/*: Changed some msg_Warn into msg_Err
* po/fr.po: Updated French translation,
* configure.ac.in: Re-enabled Swedish translation,
* Makefile.am: Do not recompile everything everytime someone changes a .h

Makefile.am
configure.ac.in
include/input_ext-intf.h
include/vlc_common.h
modules/access/dvd/access.c
modules/access/file.c
modules/gui/macosx/prefs.h
modules/gui/macosx/prefs.m
po/fr.po
src/extras/libc.c
src/input/input.c

index 7f896b038971bb4ab469f760f23c3ff68538a41f..a86d3cd8cfd559c528db8d829be16017869a8189 100644 (file)
@@ -207,7 +207,11 @@ include/vlc_symbols.h: Makefile $(HEADERS_include)
        echo '#ifdef __PLUGIN__' >> $@.in
        cat $(HEADERS_include) | grep '^ *VLC_EXPORT.*;' | sed -e 's/VLC_EXPORT( *\([^,]*\), *\([^,]*\), *\(.*\));.*/#   define \2 p_symbols->\2_inner/' >> $@.in
        echo '#endif /* __PLUGIN__ */' >> $@.in
-       mv -f $@.in $@
+       if ! diff -q $@ $@.in; then \
+               mv -f $@.in $@ ; \
+       else \
+               rm -f $@.in ; \
+       fi
 
 src/misc/modules_plugin.h: Makefile src/misc/modules_plugin.h.in $(HEADERS_include)
        rm -f $@.tmp && cp $@.in $@.tmp
@@ -215,7 +219,11 @@ src/misc/modules_plugin.h: Makefile src/misc/modules_plugin.h.in $(HEADERS_inclu
        echo '#define STORE_SYMBOLS( p_symbols ) \' >> $@.tmp
        cat $(HEADERS_include) | grep '^ *VLC_EXPORT.*;' | sed -e 's/VLC_EXPORT( *\([^,]*\), *\([^,]*\), *\(.*\));.*/    (p_symbols)->\2_inner = \2; \\/' >> $@.tmp
        echo '' >> $@.tmp
-       mv -f $@.tmp $@
+       if ! diff -q $@ $@.tmp; then \
+               mv -f $@.tmp $@ ; \
+       else \
+               rm -f $@.tmp ; \
+       fi
 
 src/misc/modules_builtin.h: Makefile src/misc/modules_builtin.h.in
        rm -f $@.tmp && cp $@.in $@.tmp
@@ -231,7 +239,11 @@ if HAVE_BUILTINS
 endif
        echo "    } while( 0 );" >> $@.tmp
        echo "" >> $@.tmp
-       mv -f $@.tmp $@
+       if ! diff -q $@ $@.tmp; then \
+               mv -f $@.tmp $@ ; \
+       else \
+               rm -f $@.tmp ; \
+       fi
 
 # These dependencies are mandatory
 $(SOURCES): include/vlc_symbols.h
index cda9265a4e7916caadc6dd3c45bdf808b64eb138..65378874d4917c45b8891b6b05810a6363a76ce9 100644 (file)
@@ -169,7 +169,7 @@ AM_CONDITIONAL(HAVE_WIN32, test "x${SYS}" = "xmingw32")
 dnl
 dnl Gettext stuff
 dnl
-ALL_LINGUAS="de en_GB fr it ja no ru nl pl"
+ALL_LINGUAS="de en_GB fr it ja no ru nl pl sv"
 AM_GNU_GETTEXT_VERSION(0.10.40)
 AM_GNU_GETTEXT
 if test "${nls_cv_force_use_gnu_gettext}" = "yes"; then
index 9a48dc1f4a50f3096e33000069ca0511f4ba07cd..9ed9923b23c610560afeae86af2601bf33b12726 100644 (file)
@@ -4,7 +4,7 @@
  * control the pace of reading.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ext-intf.h,v 1.84 2003/01/16 23:25:54 lool Exp $
+ * $Id: input_ext-intf.h,v 1.85 2003/02/08 22:20:28 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -330,6 +330,7 @@ struct input_thread_t
 
     /* Playlist item */
     char *  psz_source;
+    char *  psz_dupsource;
     char *  psz_access;
     char *  psz_demux;
     char *  psz_name;
index 465ed776ce5753c52cbcda41e478aea8c0067190..44cbcdc5338d2a0143f04a153f906e03139098b2 100644 (file)
@@ -3,7 +3,7 @@
  * Collection of useful common types and macros definitions
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: vlc_common.h,v 1.52 2003/01/28 17:11:38 sam Exp $
+ * $Id: vlc_common.h,v 1.53 2003/02/08 22:20:28 massiot Exp $
  *
  * Authors: Samuel Hocevar <sam@via.ecp.fr>
  *          Vincent Seguin <seguin@via.ecp.fr>
@@ -542,6 +542,8 @@ static inline uint64_t U64_AT( void * _p )
 #   define vlc_strncasecmp NULL
 #endif
 
+VLC_EXPORT( char *, vlc_wraptext, ( char *psz_text, size_t i_line ) );
+
 /* Format type specifiers for 64 bits numbers */
 #if !defined(WIN32) && !defined(UNDER_CE)
 #   define I64Fd "%lld"
index 990c6a7607754285a749173cfd07df656993530b..04c00dfa5390e685f2da8d9ec3108e83ca03b40f 100644 (file)
@@ -8,7 +8,7 @@
  *  -udf.* to find files
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: access.c,v 1.9 2003/01/28 22:03:21 sam Exp $
+ * $Id: access.c,v 1.10 2003/02/08 22:20:28 massiot Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -816,8 +816,8 @@ static char * DVDParse( input_thread_t * p_input )
     /* check block device */
     if( stat( psz_device, &stat_info ) == -1 )
     {
-        msg_Err( p_input, "cannot stat() device `%s' (%s)",
-                          psz_device, strerror(errno));
+        msg_Warn( p_input, "cannot stat() device `%s' (%s)",
+                  psz_device, strerror(errno));
         free( psz_device );
         return NULL;
     }
index bc02d6b6625087c8ad977a95546c05ef9dd252ec..e813366e42837ad8538003aaef9837c5098c2e27 100644 (file)
@@ -2,7 +2,7 @@
  * file.c: file input (file: access plug-in)
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: file.c,v 1.9 2003/01/05 20:45:29 massiot Exp $
+ * $Id: file.c,v 1.10 2003/02/08 22:20:28 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -108,10 +108,10 @@ static int Open( vlc_object_t *p_this )
     if( !b_stdin && (i_stat = stat( psz_name, &stat_info )) == (-1) )
     {
 #   ifdef HAVE_ERRNO_H
-        msg_Err( p_input, "cannot stat() file `%s' (%s)",
-                          psz_name, strerror(errno));
+        msg_Warn( p_input, "cannot stat() file `%s' (%s)",
+                  psz_name, strerror(errno));
 #   else
-        msg_Err( p_input, "cannot stat() file `%s'", psz_name );
+        msg_Warn( p_input, "cannot stat() file `%s'", psz_name );
 #   endif
         return VLC_EGENERIC;
     }
index c01a8dd8743888b20c00135cbf331ca53bcc011a..145055c49f54b1ae986b25a8bc0d80b18a4280e5 100644 (file)
@@ -2,7 +2,7 @@
  * prefs.h: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: prefs.h,v 1.1 2002/11/05 03:57:16 jlj Exp $
+ * $Id: prefs.h,v 1.2 2003/02/08 22:20:28 massiot Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net> 
  *
@@ -21,6 +21,8 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
+#define PREFS_WRAP 60
+
 /*****************************************************************************
  * VLCPrefs interface
  *****************************************************************************/
index bd64a5f53650b453c902e2b696dd3c94fff230bf..0eb8e984fc0fa51076ce83928909dc1bbdda479c 100644 (file)
@@ -2,7 +2,7 @@
  * prefs.m: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: prefs.m,v 1.10 2003/01/31 02:53:52 jlj Exp $
+ * $Id: prefs.m,v 1.11 2003/02/08 22:20:28 massiot Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *
 
 #define INPUT_FIELD( ctype, cname, label, w, msg, param, tip ) \
     { \
+        char * psz_duptip = strdup(tip); \
         s_rc.size.height = 25; \
         s_rc.size.width = w; \
         s_rc.origin.y += 10; \
         [o_text_field setAlignment: NSRightTextAlignment]; \
         CONTROL_CONFIG( o_text_field, o_module_name, ctype, cname ); \
         [o_text_field msg: param]; \
-        [o_text_field setToolTip: [NSApp localizedString: tip]]; \
+        if ( psz_duptip != NULL ) \
+        { \
+            [o_text_field setToolTip: [NSApp localizedString: \
+                                       vlc_wraptext(psz_duptip, PREFS_WRAP)]]; \
+            free(psz_duptip);\
+        } \
         [o_view addSubview: [o_text_field autorelease]]; \
         [[NSNotificationCenter defaultCenter] addObserver: self \
             selector: @selector(configChanged:) \
             NSPopUpButton *o_modules;
             NSButton *o_btn_select;
             NSButton *o_btn_configure;
+            char * psz_duptip = strdup(p_item->psz_longtext);
 
 #define MODULE_BUTTON( button, title, sel ) \
     { \
             [o_modules setTag: i_module_tag++];
             [o_modules setTarget: self];
             [o_modules setAction: @selector(moduleSelected:)];
-            [o_modules setToolTip: [NSApp localizedString: p_item->psz_longtext]];
+            if ( psz_duptip != NULL )
+            {
+                [o_modules setToolTip: [NSApp localizedString:
+                                        vlc_wraptext(psz_duptip, PREFS_WRAP)]];
+                free( psz_duptip );
+            }
             [o_cview addSubview: [o_modules autorelease]];
 
             MODULE_BUTTON( o_btn_configure, _NS("Configure"),
             {
                 int i;
                 VLCComboBox *o_combo_box;
+                char * psz_duptip = strdup(p_item->psz_longtext);
 
                 s_rc.size.height = 27;
                 s_rc.size.width = 150;
                 o_combo_box = [[VLCComboBox alloc] initWithFrame: s_rc];
                 CONTROL_CONFIG( o_combo_box, o_module_name,
                                 CONFIG_ITEM_STRING, p_item->psz_name );
-                [o_combo_box setToolTip:
-                    [NSApp localizedString: p_item->psz_longtext]];
+                if ( psz_duptip != NULL )
+                {
+                    [o_combo_box setToolTip: [NSApp localizedString:
+                                        vlc_wraptext(psz_duptip, PREFS_WRAP)]];
+                    free( psz_duptip );
+                }
                 [o_view addSubview: [o_combo_box autorelease]];
                 [[NSNotificationCenter defaultCenter] addObserver: self
                     selector: @selector(configChanged:)
         case CONFIG_ITEM_BOOL:
         {
             VLCButton *o_btn_bool;
+            char * psz_duptip = strdup(p_item->psz_longtext);
 
             s_rc.size.height = 27;
             s_rc.size.width = s_vrc.size.width - X_ORIGIN * 2 - 20;
             [o_btn_bool setIntValue: p_item->i_value];
             [o_btn_bool setTitle:
                 [NSApp localizedString: p_item->psz_text]];
-            [o_btn_bool setToolTip:
-                [NSApp localizedString: p_item->psz_longtext]];
+            if ( psz_duptip != NULL )
+            {
+                [o_btn_bool setToolTip: [NSApp localizedString:
+                                        vlc_wraptext(psz_duptip, PREFS_WRAP)]];
+                free( psz_duptip );
+            }
             [o_btn_bool setTarget: self];
             [o_btn_bool setAction: @selector(configChanged:)];
             CONTROL_CONFIG( o_btn_bool, o_module_name,
index ecd5e6930f68adc18d6a9a610fd67695e3d57466..1cf20f604cdb7d1ff0bf5c4540ab70ecb49cbe67 100644 (file)
--- a/po/fr.po
+++ b/po/fr.po
@@ -336,7 +336,7 @@ msgstr "module de filtre vid
 msgid ""
 "This will allow you to add a post-processing filter to enhance the picture "
 "quality, for instance deinterlacing, or to clone or distort the video window."
-msgstr "Cette option vous permet d'ajouter un filter de post-processing pour améliorer la qualité de l'image, par exemple du désentralement, ou pour dupliquer ou déformer la fenêtre video."
+msgstr "Cette option vous permet d'ajouter un filtre de post-processing pour améliorer la qualité de l'image, par exemple du désentralement, ou pour dupliquer ou déformer la fenêtre video."
 
 #: src/libvlc.h:172
 msgid "source aspect ratio"
index b699a9c274caba91cfda6c6ff7fee496bcc815e2..3d6e493d6b3011a676a539693706753a9c439ef0 100644 (file)
@@ -2,7 +2,7 @@
  * libc.c: Extra libc function for some systems.
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: libc.c,v 1.6 2002/12/30 13:34:03 sam Exp $
+ * $Id: libc.c,v 1.7 2003/02/08 22:20:28 massiot Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Samuel Hocevar <sam@zoy.org>
@@ -171,3 +171,55 @@ char *vlc_dgettext( const char *package, const char *msgid )
 #endif
 }
 
+/*****************************************************************************
+ * wraptext: insert \n at convenient places. CAUTION: modifies its argument
+ *****************************************************************************/
+char *vlc_wraptext( char *psz_text, size_t i_line )
+{
+    size_t i_len = strlen(psz_text);
+    char * psz_line = psz_text;
+
+    while ( i_len > i_line )
+    {
+        /* Look if there is a newline somewhere. */
+        char * psz_parser = psz_line;
+        while ( psz_parser <= psz_line + i_line && *psz_parser != '\n' )
+        {
+            psz_parser++;
+        }
+        if ( *psz_parser == '\n' )
+        {
+            i_len -= psz_parser + 1 - psz_line;
+            psz_line = psz_parser + 1;
+            continue;
+        }
+
+        /* Find the furthest space. */
+        psz_parser = psz_line + i_line;
+        while ( psz_parser > psz_line && *psz_parser != ' ' )
+        {
+            psz_parser--;
+        }
+        if ( *psz_parser == ' ' )
+        {
+            *psz_parser = '\n';
+            i_len -= psz_parser + 1 - psz_line;
+            psz_line = psz_parser + 1;
+            continue;
+        }
+
+        /* Wrapping has failed. Find the first space or newline after i_line. */
+        psz_parser = psz_line + i_line + 1;
+        while ( psz_parser < psz_line + i_len
+                 && *psz_parser != ' ' && *psz_parser != '\n' )
+        {
+            psz_parser++;
+        }
+
+        if ( psz_parser < psz_line + i_len ) *psz_parser = '\n';
+        i_len -= psz_parser + 1 - psz_line;
+        psz_line = psz_parser + 1;
+    }
+
+    return psz_text;
+}
index 657b06ed4ad8e8f114301b7ee162f4722dcf505f..0ba4648799839bf6028ae5ef757226dcd4fbb7f2 100644 (file)
@@ -4,7 +4,7 @@
  * decoders.
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: input.c,v 1.221 2002/12/31 01:54:36 massiot Exp $
+ * $Id: input.c,v 1.222 2003/02/08 22:20:28 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -370,7 +370,7 @@ static int RunThread( input_thread_t *p_input )
 static int InitThread( input_thread_t * p_input )
 {
     /* Parse source string. Syntax : [[<access>][/<demux>]:][<source>] */
-    char * psz_parser = p_input->psz_source;
+    char * psz_parser = p_input->psz_dupsource = strdup(p_input->psz_source);
 
     /* Skip the plug-in names */
     while( *psz_parser && *psz_parser != ':' )
@@ -390,6 +390,8 @@ static int InitThread( input_thread_t * p_input )
     {
         p_input->psz_access = p_input->psz_demux = "";
         p_input->psz_name = p_input->psz_source;
+        free( p_input->psz_dupsource);
+        p_input->psz_dupsource = NULL;
     }
     else
     {
@@ -455,6 +457,20 @@ static int InitThread( input_thread_t * p_input )
     p_input->p_access = module_Need( p_input, "access",
                                      p_input->psz_access );
 
+    if ( p_input->p_access == NULL
+          && (*p_input->psz_demux || *p_input->psz_access) )
+    {
+        /* Maybe we got something like :
+         * /Volumes/toto:titi/gabu.mpg */
+        p_input->psz_access = p_input->psz_demux = "";
+        p_input->psz_name = p_input->psz_source;
+        free( p_input->psz_dupsource);
+        p_input->psz_dupsource = NULL;
+
+        p_input->p_access = module_Need( p_input, "access",
+                                         p_input->psz_access );
+    }
+
     if( p_input->p_access == NULL )
     {
         msg_Err( p_input, "no suitable access module for `%s/%s://%s'",
@@ -571,6 +587,7 @@ static void EndThread( input_thread_t * p_input )
     input_AccessEnd( p_input );
 
     free( p_input->psz_source );
+    if ( p_input->psz_dupsource != NULL ) free( p_input->psz_dupsource );
 
     /* Tell we're dead */
     p_input->b_dead = 1;