]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/prefs_widgets.m
* slightly enlarged the progress_for_downloads-panel-to-be and fixed some bugs in...
[vlc] / modules / gui / macosx / prefs_widgets.m
index 2d6c9949625a8cbc7383538e4d04ccefd79535c6..7eb5831bb995b9b57284241f6604bed1778ffb88 100644 (file)
@@ -1,11 +1,11 @@
 /*****************************************************************************
  * prefs_widgets.m: Preferences controls
  *****************************************************************************
- * Copyright (C) 2002-2003 VideoLAN
+ * Copyright (C) 2002-2003 the VideoLAN team
  * $Id$
  *
  * Authors: Derk-Jan Hartman <hartman at videolan.org>
- *          Jérôme Decoodt <djc at videolan.org>
+ *          Jérôme Decoodt <djc at videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
 #define OFFSET_RIGHT 20
 #define OFFSET_BETWEEN 2
 
-#define MACOS_VERSION [[[NSDictionary dictionaryWithContentsOfFile: \
-            @"/System/Library/CoreServices/SystemVersion.plist"] \
-            objectForKey: @"ProductVersion"] floatValue]
-
 #define UPWARDS_WHITE_ARROW                 "\xE2\x87\xA7" 
 #define OPTION_KEY                          "\xE2\x8C\xA5"
 #define UP_ARROWHEAD                        "\xE2\x8C\x83"
@@ -55,6 +51,7 @@
         action:nil keyEquivalent:@""];                                      \
     [o_mi setKeyEquivalentModifierMask:                                     \
         0];                                                                 \
+if( MACOS_VERSION >= 10.3 )                                                 \
     [o_mi setAlternate: NO];                                                \
     [o_mi setTag:                                                           \
         ( value )];                                                         \
@@ -819,6 +816,12 @@ if( MACOS_VERSION >= 10.3 )                                                 \
                       withView: (NSView *)o_parent_view
 {
     VLCConfigControl *p_control = NULL;
+    /* Skip depracated options */
+    if( _p_item->psz_current )
+    {
+        return NULL;
+    }
+
     switch( _p_item->i_type )
     {
     case CONFIG_ITEM_STRING:
@@ -958,21 +961,17 @@ if( MACOS_VERSION >= 10.3 )                                                 \
     case CONFIG_ITEM_MODULE:
     case CONFIG_ITEM_MODULE_LIST:
     case CONFIG_ITEM_MODULE_LIST_CAT:
-fprintf( stderr, "Applying %s to %s\n" , [self stringValue], psz_name );
         config_PutPsz( VLCIntf, psz_name, [self stringValue] );
         break;
     case CONFIG_ITEM_KEY:
         /* So you don't need to restart to have the changes take effect */
-fprintf( stderr, "Applying %d to %s\n" , [self intValue], psz_name );
         val.i_int = [self intValue];
         var_Set( VLCIntf->p_vlc, psz_name, val );
     case CONFIG_ITEM_INTEGER:
     case CONFIG_ITEM_BOOL:
-fprintf( stderr, "Applying %d to %s\n" , [self intValue], psz_name );
         config_PutInt( VLCIntf, psz_name, [self intValue] );
         break;
     case CONFIG_ITEM_FLOAT:
-fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name );
         config_PutFloat( VLCIntf, psz_name, [self floatValue] );
         break;
     }
@@ -982,6 +981,12 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name );
 {
     return [o_label frame].size.width;
 }
+
+- (void) alignWithXPosition:(int)i_xPos;
+{
+    /* FIXME: not implemented atm, but created to shut up the warning
+     * about "method definition not found" -- FK @ 7/24/05 */
+}
 @end
 
 @implementation StringConfigControl
@@ -1798,7 +1803,7 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name );
     [o_stepper setFloatValue: [o_textfield floatValue]];
 }
 
-- (int)floatValue
+- (float)floatValue
 {
     return [o_stepper floatValue];
 }
@@ -1908,7 +1913,7 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name );
     [o_slider setFloatValue: [o_textfield floatValue]];
 }
 
-- (int)floatValue
+- (float)floatValue
 {
     return [o_slider floatValue];
 }
@@ -1931,39 +1936,27 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name );
     {
         i_view_type = CONFIG_ITEM_BOOL;
 
+        /* add the checkbox */
+        o_tooltip = [[VLCMain sharedInstance]
+            wrapString: [[VLCMain sharedInstance]
+            localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP];
+        ADD_CHECKBOX( o_checkbox, mainFrame, 0,
+                        0, @"", o_tooltip, p_item->i_value, NSImageLeft)
+        [o_checkbox setAutoresizingMask:NSViewNotSizable ];
+        [self addSubview: o_checkbox];
         /* add the label */
         if( p_item->psz_text )
             o_labelString = [[VLCMain sharedInstance]
                                 localizedString: p_item->psz_text];
         else
             o_labelString = [NSString stringWithString:@""];
-        ADD_LABEL( o_label, mainFrame, 0, 0, o_labelString )
+        ADD_LABEL( o_label, mainFrame, [o_checkbox frame].size.width, 0, o_labelString )
         [o_label setAutoresizingMask:NSViewNotSizable ];
         [self addSubview: o_label];
-        /* add the checkbox */
-        o_tooltip = [[VLCMain sharedInstance]
-            wrapString: [[VLCMain sharedInstance]
-            localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP];
-        ADD_CHECKBOX( o_checkbox, mainFrame, [o_label frame].size.width,
-                        0, @"", o_tooltip, p_item->i_value, NSImageLeft)
-        [o_checkbox setAutoresizingMask:NSViewNotSizable ];
-        [self addSubview: o_checkbox];
     }
     return self;
 }
 
-- (void) alignWithXPosition:(int)i_xPos
-{
-    NSRect frame;
-    frame = [o_label frame];
-    frame.origin.x = i_xPos - frame.size.width - 3;
-    [o_label setFrame:frame];
-
-    frame = [o_checkbox frame];
-    frame.origin.x = i_xPos;
-    [o_checkbox setFrame:frame];
-}
-
 - (void)dealloc
 {
     [o_checkbox release];
@@ -2120,7 +2113,7 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name );
     i_new_key |= ([o_shift_checkbox state] == NSOnState) ?
         KEY_MODIFIER_SHIFT : 0;
 
-    i_new_key |= StringToKey([[[o_popup selectedItem] title] cString]);
+    i_new_key |= StringToKey((char *)[[[o_popup selectedItem] title] cString]);
     return i_new_key;
 }
 @end
@@ -2299,11 +2292,13 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST )
     o_scrollview = [[[NSScrollView alloc] initWithFrame: s_rc] retain];
     [o_scrollview setDrawsBackground: NO];
     [o_scrollview setBorderType: NSBezelBorder];
-    [o_scrollview setAutohidesScrollers:YES];
+    if( MACOS_VERSION >= 10.3 )
+        [o_scrollview setAutohidesScrollers:YES];
 
     NSTableView *o_tableview;
     o_tableview = [[NSTableView alloc] initWithFrame : s_rc];
-    [o_tableview setUsesAlternatingRowBackgroundColors:YES];
+    if( MACOS_VERSION >= 10.3 )
+        [o_tableview setUsesAlternatingRowBackgroundColors:YES];
     [o_tableview setHeaderView:nil];
 /* TODO: find a good way to fix the row height and text size*/
 /* FIXME: support for multiple selection... */
@@ -2363,7 +2358,7 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST )
         {
             o_newstring = [o_newstring stringByAppendingString:
                 [[o_modulearray objectAtIndex:i] objectAtIndex:0]];
-            o_newstring = [o_newstring stringByAppendingString:@","];
+            o_newstring = [o_newstring stringByAppendingString:@":"];
         }
 
     [o_textfield setStringValue: [o_newstring