]> git.sesse.net Git - vlc/commitdiff
* modules/codec/quicktime.c: i had accidently upgraded this plugin to 100
authorDerk-Jan Hartman <hartman@videolan.org>
Mon, 26 May 2003 14:59:37 +0000 (14:59 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Mon, 26 May 2003 14:59:37 +0000 (14:59 +0000)
* modules/demux/avi/avi.c: fixed a spelling error reported by emulynx
* modules/gui/macosx/intf.?: added a wrapString:toWidth function
* modules/gui/macosx/prefs.?: removed the use of vlc_wraptext, because it
  was ugly. now we use our own, osx method. This fixes tooltips in japanese
  I'm not sure, but i think src/extras/libc.c vlc_wraptext is now unused.

modules/codec/quicktime.c
modules/demux/avi/avi.c
modules/gui/macosx/intf.h
modules/gui/macosx/intf.m
modules/gui/macosx/prefs.h
modules/gui/macosx/prefs.m

index 8ffb30b9a2825d30735897a56c5e704aebb4e005..7cff47ab5bc192ba1edc256a5ea4b1e566172210 100644 (file)
@@ -2,7 +2,7 @@
  * quicktime.c: a quicktime decoder that uses the QT library/dll
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: quicktime.c,v 1.5 2003/05/24 02:48:55 hartman Exp $
+ * $Id: quicktime.c,v 1.6 2003/05/26 14:59:37 hartman Exp $
  *
  * Authors: Laurent Aimar <fenrir at via.ecp.fr>
  *          Derk-Jan Hartman <thedj at users.sf.net>
@@ -63,7 +63,7 @@ static int  RunDecoderVideo( decoder_fifo_t * );
 
 vlc_module_begin();
     set_description( _("QuickTime library decoder") );
-    set_capability( "decoder", 100 );
+    set_capability( "decoder", 10 );
     set_callbacks( OpenDecoder, NULL );
 
     /* create a mutex */
index 4bed2f83f94a4688b20bd57a100824fe831435c0..4f950fb1273e80e5cd854cea8c1b87768ea5eefb 100644 (file)
@@ -2,7 +2,7 @@
  * avi.c : AVI file Stream input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: avi.c,v 1.48 2003/05/22 21:42:44 gbazin Exp $
+ * $Id: avi.c,v 1.49 2003/05/26 14:59:37 hartman Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -960,7 +960,7 @@ static int AVIInit( vlc_object_t * p_this )
     p_input->pf_demux = AVIDemux_Seekable;
     if( AVI_TestFile( p_input ) )
     {
-        msg_Warn( p_input, "avi module discarded (invalid headr)" );
+        msg_Warn( p_input, "avi module discarded (invalid header)" );
         return VLC_EGENERIC;
     }
 
index 94626bf65a5878b084065c6a20f8e527186e90c4..067e398075c9ef528eef405fb0573b88dd319abc 100644 (file)
@@ -2,7 +2,7 @@
  * intf.h: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: intf.h,v 1.40 2003/05/20 18:53:03 hartman Exp $
+ * $Id: intf.h,v 1.41 2003/05/26 14:59:37 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -43,6 +43,7 @@
 - (NSString *)localizedString:(char *)psz;
 - (char *)delocalizeString:(NSString *)psz;
 - (NSStringEncoding)getEncoding;
+- (NSString *)wrapString: (NSString *)o_in_string toWidth: (int)i_width;
 
 - (void)setIntf:(intf_thread_t *)p_intf;
 - (intf_thread_t *)getIntf;
index 886959a9266064a96e78adca4c0486d3b47bd89f..3ad9323420db2d95bf84f1412bd492a38c9b936e 100644 (file)
@@ -2,7 +2,7 @@
  * intf.m: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: intf.m,v 1.86 2003/05/25 17:27:13 massiot Exp $
+ * $Id: intf.m,v 1.87 2003/05/26 14:59:37 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -169,6 +169,49 @@ static void Run( intf_thread_t *p_intf )
     return i_encoding;
 }
 
+/* i_width is in pixels */
+- (NSString *)wrapString: (NSString *)o_in_string toWidth: (int) i_width
+{
+    NSMutableString *o_wrapped;
+    NSString *o_out_string;
+    NSRange glyphRange, effectiveRange, charRange;
+    NSRect lineFragmentRect;
+    unsigned glyphIndex, breaksInserted = 0;
+
+    NSTextStorage *o_storage = [[NSTextStorage alloc] initWithString: o_in_string
+        attributes: [NSDictionary dictionaryWithObjectsAndKeys:
+        [NSFont labelFontOfSize: 0.0], NSFontAttributeName, nil]];
+    NSLayoutManager *o_layout_manager = [[NSLayoutManager alloc] init];
+    NSTextContainer *o_container = [[NSTextContainer alloc]
+        initWithContainerSize: NSMakeSize(i_width, 2000)];
+    
+    [o_layout_manager addTextContainer: o_container];
+    [o_container release];
+    [o_storage addLayoutManager: o_layout_manager];
+    [o_layout_manager release];
+        
+    o_wrapped = [o_in_string mutableCopy];
+    glyphRange = [o_layout_manager glyphRangeForTextContainer: o_container];
+    
+    for( glyphIndex = glyphRange.location ; glyphIndex < NSMaxRange(glyphRange) ;
+            glyphIndex += effectiveRange.length) {
+        lineFragmentRect = [o_layout_manager lineFragmentRectForGlyphAtIndex: glyphIndex
+                                            effectiveRange: &effectiveRange];
+        charRange = [o_layout_manager characterRangeForGlyphRange: effectiveRange
+                                    actualGlyphRange: &effectiveRange];
+        if ([o_wrapped lineRangeForRange:
+                NSMakeRange(charRange.location + breaksInserted, charRange.length)].length > charRange.length) {
+            [o_wrapped insertString: @"\n" atIndex: NSMaxRange(charRange) + breaksInserted];
+            breaksInserted++;
+        }
+    }
+    o_out_string = [NSString stringWithString: o_wrapped];
+    [o_wrapped release];
+    [o_storage release];
+    
+    return o_out_string;
+}
+
 - (void)setIntf:(intf_thread_t *)_p_intf
 {
     p_intf = _p_intf;
index 0f4a9a1a1005b967a0e521b8dc97dd34e1e21c03..75c834337bb175fa0e487ac71a420cd7bcdb1f77 100644 (file)
@@ -2,7 +2,7 @@
  * prefs.h: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: prefs.h,v 1.8 2003/05/26 01:25:12 hartman Exp $
+ * $Id: prefs.h,v 1.9 2003/05/26 14:59:37 hartman Exp $
  *
  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net> 
  *
@@ -21,7 +21,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
-#define PREFS_WRAP 60
+#define PREFS_WRAP 300
 
 @interface VLCTreeItem : NSObject
 {
index fe40e0d67adad24e1442648f4f8b8316413d63ea..c428864a48dcbeb8b1a5ac3a5bfd972cbd6abbb4 100644 (file)
@@ -2,7 +2,7 @@
  * prefs.m: MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2002-2003 VideoLAN
- * $Id: prefs.m,v 1.29 2003/05/26 02:03:10 hartman Exp $
+ * $Id: prefs.m,v 1.30 2003/05/26 14:59:37 hartman Exp $
  *
  * Authors:    Jon Lech Johansen <jon-vl@nanocrew.net>
  *             Derk-Jan Hartman <thedj at users.sf.net>
     { \
         char * psz_duptip = NULL; \
         if ( p_item->psz_longtext != NULL ) \
-            psz_duptip = vlc_wraptext( strdup( p_item->psz_longtext ), PREFS_WRAP ); \
+            psz_duptip = strdup( p_item->psz_longtext ); \
         s_rc.size.height = 25; \
         s_rc.size.width = w; \
         s_rc.origin.y += 10; \
         [o_text_field msg: param]; \
         if ( psz_duptip != NULL ) \
         { \
-            [o_text_field setToolTip: [NSApp localizedString: \
-                                       psz_duptip]]; \
+            [o_text_field setToolTip: [NSApp wrapString: [NSApp localizedString: \
+                                       psz_duptip] toWidth: PREFS_WRAP ]]; \
             free(psz_duptip);\
         } \
         [o_view addSubview: [o_text_field autorelease]]; \
                 char * psz_duptip = NULL;
 
                 if ( p_item->psz_longtext != NULL )
-                    psz_duptip = vlc_wraptext( strdup( p_item->psz_longtext ), PREFS_WRAP );
+                    psz_duptip = strdup( p_item->psz_longtext );
 
                 s_rc.size.height = 30;
                 s_rc.size.width = 200;
                 
                 if ( psz_duptip != NULL )
                 {
-                    [o_modules setToolTip: [NSApp localizedString: psz_duptip]];
+                    [o_modules setToolTip: [NSApp wrapString: [NSApp localizedString: psz_duptip] toWidth: PREFS_WRAP]];
                     free( psz_duptip );
                 }
                 [o_view addSubview: [o_modules autorelease]];
                     VLCComboBox *o_combo_box;
                     char * psz_duptip = NULL;
                     if ( p_item->psz_longtext != NULL )
-                        psz_duptip = vlc_wraptext( strdup( p_item->psz_longtext ), PREFS_WRAP );
+                        psz_duptip = strdup( p_item->psz_longtext );
     
                     s_rc.size.height = 27;
                     s_rc.size.width = 200;
 
                     if ( psz_duptip != NULL )
                     {
-                        [o_combo_box setToolTip: [NSApp localizedString: psz_duptip]];
+                        [o_combo_box setToolTip: [NSApp wrapString: [NSApp localizedString: psz_duptip] toWidth: PREFS_WRAP]];
                         free( psz_duptip );
                     }
                     [o_view addSubview: [o_combo_box autorelease]];
                     VLCSlider *o_slider;
                     char * psz_duptip = NULL;
                     if ( p_item->psz_longtext != NULL )
-                        psz_duptip = vlc_wraptext( strdup( p_item->psz_longtext ), PREFS_WRAP );
+                        psz_duptip = strdup( p_item->psz_longtext );
         
                     s_rc.size.height = 27;
                     s_rc.size.width = 200;
 
                     if ( psz_duptip != NULL )
                     {
-                        [o_slider setToolTip: [NSApp localizedString: psz_duptip]];
+                        [o_slider setToolTip: [NSApp wrapString: [NSApp localizedString: psz_duptip] toWidth: PREFS_WRAP]];
                         free( psz_duptip );
                     }
                     [o_slider setTarget: self];
                     VLCSlider *o_slider;
                     char * psz_duptip = NULL;
                     if ( p_item->psz_longtext != NULL )
-                        psz_duptip = vlc_wraptext( strdup( p_item->psz_longtext ), PREFS_WRAP );
+                        psz_duptip = strdup( p_item->psz_longtext );
         
                     s_rc.size.height = 27;
                     s_rc.size.width = 200;
 
                     if ( psz_duptip != NULL )
                     {
-                        [o_slider setToolTip: [NSApp localizedString: psz_duptip]];
+                        [o_slider setToolTip: [NSApp wrapString: [NSApp localizedString: psz_duptip] toWidth: PREFS_WRAP]];
                         free( psz_duptip );
                     }
                     [o_slider setTarget: self];
                 char * psz_duptip = NULL;
 
                 if ( p_item->psz_longtext != NULL )
-                    psz_duptip = vlc_wraptext( strdup( p_item->psz_longtext ), PREFS_WRAP );
+                    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 setTitle: [NSApp localizedString: p_item->psz_text]];
                 if ( psz_duptip != NULL )
                 {
-                    [o_btn_bool setToolTip: [NSApp localizedString: psz_duptip]];
+                    [o_btn_bool setToolTip: [NSApp wrapString: [NSApp localizedString: psz_duptip] toWidth: PREFS_WRAP]];
                     free( psz_duptip );
                 }
                 [o_btn_bool setTarget: self];