X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fmacosx%2Fprefs_widgets.m;h=01ee64ecce4e006a3f62faf7824cbbfbe248d087;hb=a921f15e3dea1e535431a9966e6ce4fce84c1651;hp=8352d4c0a33d2d3badd1427372ba740da58aa666;hpb=8363673095c92d7f925ce3bde8681147643adf88;p=vlc diff --git a/modules/gui/macosx/prefs_widgets.m b/modules/gui/macosx/prefs_widgets.m index 8352d4c0a3..01ee64ecce 100644 --- a/modules/gui/macosx/prefs_widgets.m +++ b/modules/gui/macosx/prefs_widgets.m @@ -1,17 +1,17 @@ /***************************************************************************** * prefs_widgets.m: Preferences controls ***************************************************************************** - * Copyright (C) 2002-2003 VideoLAN + * Copyright (C) 2002-2007 the VideoLAN team * $Id$ * * Authors: Derk-Jan Hartman - * Jérôme Decoodt + * Jérôme Decoodt * * 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 * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -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. *****************************************************************************/ /***************************************************************************** @@ -28,7 +28,11 @@ #include /* malloc(), free() */ #include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include #include "vlc_keys.h" #include "intf.h" @@ -38,11 +42,7 @@ #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 UPWARDS_WHITE_ARROW "\xE2\x87\xA7" #define OPTION_KEY "\xE2\x8C\xA5" #define UP_ARROWHEAD "\xE2\x8C\x83" #define PLACE_OF_INTEREST_SIGN "\xE2\x8C\x98" @@ -55,13 +55,10 @@ action:nil keyEquivalent:@""]; \ [o_mi setKeyEquivalentModifierMask: \ 0]; \ -if( MACOS_VERSION >= 10.3 ) \ [o_mi setAlternate: NO]; \ [o_mi setTag: \ ( value )]; \ [o_menu addItem: o_mi]; \ -if( MACOS_VERSION >= 10.3 ) \ -{ \ /* Ctrl */ \ o_mi = [[NSMenuItem alloc] initWithTitle: \ [[NSString stringWithUTF8String: \ @@ -249,10 +246,10 @@ if( MACOS_VERSION >= 10.3 ) \ [o_mi setTag: \ KEY_MODIFIER_COMMAND | ( value )]; \ [o_menu addItem: o_mi]; \ -} \ } -#define ADD_LABEL( o_label, superFrame, x_offset, my_y_offset, label ) \ +#define ADD_LABEL( o_label, superFrame, x_offset, my_y_offset, label, \ + tooltip ) \ { \ NSRect s_rc = superFrame; \ s_rc.size.height = 17; \ @@ -264,6 +261,7 @@ if( MACOS_VERSION >= 10.3 ) \ [o_label setEditable: NO]; \ [o_label setSelectable: NO]; \ [o_label setStringValue: label]; \ + [o_label setToolTip: tooltip]; \ [o_label setFont:[NSFont systemFontOfSize:0]]; \ [o_label sizeToFit]; \ } @@ -400,7 +398,7 @@ if( MACOS_VERSION >= 10.3 ) \ if( self != nil ) { p_item = _p_item; - psz_name = strdup( p_item->psz_name ); + psz_name = p_item->psz_name; o_label = NULL; i_type = p_item->i_type; i_view_type = 0; @@ -420,7 +418,7 @@ if( MACOS_VERSION >= 10.3 ) \ - (void)dealloc { if( o_label ) [o_label release]; - if( psz_name ) free( psz_name ); + free( psz_name ); [super dealloc]; } @@ -820,6 +818,7 @@ if( MACOS_VERSION >= 10.3 ) \ withView: (NSView *)o_parent_view { VLCConfigControl *p_control = NULL; + switch( _p_item->i_type ) { case CONFIG_ITEM_STRING: @@ -855,7 +854,7 @@ if( MACOS_VERSION >= 10.3 ) \ initWithItem: _p_item withView: o_parent_view]; } - else if( _p_item->i_min != 0 || _p_item->i_max != 0 ) + else if( _p_item->min.i != 0 || _p_item->max.i != 0 ) { p_control = [[RangedIntegerConfigControl alloc] initWithItem: _p_item @@ -874,7 +873,7 @@ if( MACOS_VERSION >= 10.3 ) \ withView: o_parent_view]; break; case CONFIG_ITEM_FLOAT: - if( _p_item->f_min != 0 || _p_item->f_max != 0 ) + if( _p_item->min.f != 0 || _p_item->max.f != 0 ) { p_control = [[RangedFloatConfigControl alloc] initWithItem: _p_item @@ -888,18 +887,9 @@ if( MACOS_VERSION >= 10.3 ) \ } break; case CONFIG_ITEM_KEY: - if( MACOS_VERSION < 10.3 ) - { - p_control = [[KeyConfigControlBefore103 alloc] - initWithItem: _p_item - withView: o_parent_view]; - } - else - { - p_control = [[KeyConfigControlAfter103 alloc] + p_control = [[KeyConfigControl alloc] initWithItem: _p_item withView: o_parent_view]; - } break; case CONFIG_ITEM_MODULE_LIST: case CONFIG_ITEM_MODULE_LIST_CAT: @@ -959,21 +949,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 ); + var_Set( VLCIntf->p_libvlc, 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; } @@ -983,6 +969,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 @@ -999,23 +991,24 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); if( [super initWithFrame: mainFrame item: _p_item] != nil ) { i_view_type = CONFIG_ITEM_STRING; + o_textfieldTooltip = [[VLCMain sharedInstance] wrapString: + [[VLCMain sharedInstance] localizedString: (char *)p_item->psz_longtext] + toWidth: PREFS_WRAP]; + /* add the label */ if( p_item->psz_text ) o_labelString = [[VLCMain sharedInstance] - localizedString: p_item->psz_text]; + localizedString: (char *)p_item->psz_text]; else o_labelString = [NSString stringWithString:@""]; - ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString ) + ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString, o_textfieldTooltip ) [o_label setAutoresizingMask:NSViewNotSizable ]; [self addSubview: o_label]; /* build the textfield */ - o_textfieldTooltip = [[VLCMain sharedInstance] wrapString: - [[VLCMain sharedInstance] localizedString: p_item->psz_longtext] - toWidth: PREFS_WRAP]; - if( p_item->psz_value ) + if( p_item->value.psz ) o_textfieldString = [[VLCMain sharedInstance] - localizedString: p_item->psz_value]; + localizedString: (char *)p_item->value.psz]; else o_textfieldString = [NSString stringWithString: @""]; ADD_TEXTFIELD( o_textfield, mainFrame, [o_label frame].size.width + 2, @@ -1069,26 +1062,28 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); { int i_index; i_view_type = CONFIG_ITEM_STRING_LIST; + + o_textfieldTooltip = [[VLCMain sharedInstance] wrapString: + [[VLCMain sharedInstance] + localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP]; + /* add the label */ if( p_item->psz_text ) o_labelString = [[VLCMain sharedInstance] - localizedString: p_item->psz_text]; + localizedString: (char *)p_item->psz_text]; else o_labelString = [NSString stringWithString:@""]; - ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString ) + ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString, o_textfieldTooltip ) [o_label setAutoresizingMask:NSViewNotSizable ]; [self addSubview: o_label]; /* build the textfield */ - o_textfieldTooltip = [[VLCMain sharedInstance] wrapString: - [[VLCMain sharedInstance] - localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP]; ADD_COMBO( o_combo, mainFrame, [o_label frame].size.width, -2, 0, o_textfieldTooltip ) [o_combo setAutoresizingMask:NSViewWidthSizable ]; for( i_index = 0; i_index < p_item->i_list; i_index++ ) - if( p_item->psz_value && - !strcmp( p_item->psz_value, p_item->ppsz_list[i_index] ) ) + if( p_item->value.psz && + !strcmp( p_item->value.psz, p_item->ppsz_list[i_index] ) ) [o_combo selectItemAtIndex: i_index]; [self addSubview: o_combo]; } @@ -1136,9 +1131,9 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); if( p_item->ppsz_list_text && p_item->ppsz_list_text[i_index] ) { return [[VLCMain sharedInstance] - localizedString: p_item->ppsz_list_text[i_index]]; + localizedString: (char *)p_item->ppsz_list_text[i_index]]; } else return [[VLCMain sharedInstance] - localizedString: p_item->ppsz_list[i_index]]; + localizedString: (char *)p_item->ppsz_list[i_index]]; } @end @@ -1147,8 +1142,7 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); withView: (NSView *)o_parent_view { NSRect mainFrame = [o_parent_view frame]; - NSString *o_labelString, *o_buttonTooltip, *o_textfieldString; - NSString *o_textfieldTooltip; + NSString *o_labelString, *o_itemTooltip, *o_textfieldString; mainFrame.size.height = 46; mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN; mainFrame.origin.x = LEFTMARGIN; @@ -1158,40 +1152,37 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); { i_view_type = CONFIG_ITEM_FILE; + o_itemTooltip = [[VLCMain sharedInstance] + wrapString: [[VLCMain sharedInstance] + localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP]; + /* is it a directory */ b_directory = ( [self getType] == CONFIG_ITEM_DIRECTORY ) ? YES : NO; /* add the label */ if( p_item->psz_text ) o_labelString = [[VLCMain sharedInstance] - localizedString: p_item->psz_text]; + localizedString: (char *)p_item->psz_text]; else o_labelString = [NSString stringWithString:@""]; - ADD_LABEL( o_label, mainFrame, 0, 3, o_labelString ) + ADD_LABEL( o_label, mainFrame, 0, 3, o_labelString, o_itemTooltip ) [o_label setAutoresizingMask:NSViewNotSizable ]; [self addSubview: o_label]; /* build the button */ - o_buttonTooltip = [[VLCMain sharedInstance] - wrapString: [[VLCMain sharedInstance] - localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP]; - ADD_RIGHT_BUTTON( o_button, mainFrame, 0, 0, o_buttonTooltip, + ADD_RIGHT_BUTTON( o_button, mainFrame, 0, 0, o_itemTooltip, _NS("Browse...") ) [o_button setAutoresizingMask:NSViewMinXMargin ]; [self addSubview: o_button]; /* build the textfield */ - o_textfieldTooltip = [[VLCMain sharedInstance] wrapString: - [[VLCMain sharedInstance] - localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP]; - if( p_item->psz_value ) - o_textfieldString = [[VLCMain sharedInstance] - localizedString: p_item->psz_value]; + if( p_item->value.psz ) + o_textfieldString = [NSString stringWithFormat: @"%s", (char *)p_item->value.psz]; else o_textfieldString = [NSString stringWithString: @""]; ADD_TEXTFIELD( o_textfield, mainFrame, 12, 2, mainFrame.size.width - 8 - [o_button frame].size.width, - o_textfieldTooltip, o_textfieldString ) + o_itemTooltip, o_textfieldString ) [o_textfield setAutoresizingMask:NSViewWidthSizable ]; [self addSubview: o_textfield]; } @@ -1225,7 +1216,7 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); types:nil modalForWindow:[sender window] modalDelegate: self - didEndSelector: @selector(pathChosenInPanel: + didEndSelector: @selector(pathChosenInPanel: withReturn: contextInfo:) contextInfo: nil]; @@ -1268,20 +1259,21 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); module_t *p_parser; i_view_type = CONFIG_ITEM_MODULE; + o_popupTooltip = [[VLCMain sharedInstance] wrapString: + [[VLCMain sharedInstance] + localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP]; + /* add the label */ if( p_item->psz_text ) o_labelString = [[VLCMain sharedInstance] - localizedString: p_item->psz_text]; + localizedString: (char *)p_item->psz_text]; else o_labelString = [NSString stringWithString:@""]; - ADD_LABEL( o_label, mainFrame, 0, -1, o_labelString ) + ADD_LABEL( o_label, mainFrame, 0, -1, o_labelString, o_popupTooltip ) [o_label setAutoresizingMask:NSViewNotSizable ]; [self addSubview: o_label]; /* build the popup */ - o_popupTooltip = [[VLCMain sharedInstance] wrapString: - [[VLCMain sharedInstance] - localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP]; ADD_POPUP( o_popup, mainFrame, [o_label frame].size.width, -2, 0, o_popupTooltip ) [o_popup setAutoresizingMask:NSViewWidthSizable ]; @@ -1293,43 +1285,46 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); p_list = vlc_list_find( VLCIntf, VLC_OBJECT_MODULE, FIND_ANYWHERE ); for( i_index = 0; i_index < p_list->i_count; i_index++ ) { - p_parser = (module_t *)p_list->p_values[i_index].p_object ; + p_parser = (module_t *)p_list->p_values[i_index].p_object; + if( p_item->i_type == CONFIG_ITEM_MODULE ) { - if( !strcmp( p_parser->psz_capability, - p_item->psz_type ) ) + if( module_IsCapable( p_parser, p_item->psz_type ) ) { NSString *o_description = [[VLCMain sharedInstance] - localizedString: p_parser->psz_longname]; + localizedString: module_GetLongName( p_parser )]; [o_popup addItemWithTitle: o_description]; - if( p_item->psz_value && - !strcmp( p_item->psz_value, p_parser->psz_object_name ) ) + if( p_item->value.psz && + !strcmp( p_item->value.psz, module_GetObjName( p_parser ) ) ) [o_popup selectItem:[o_popup lastItem]]; } } else { - module_config_t *p_config; - if( !strcmp( p_parser->psz_object_name, "main" ) ) - continue; - - p_config = p_parser->p_config; - if( p_config ) do + int i; + + if( !strcmp( module_GetObjName( p_parser ), "main" ) ) + continue; + unsigned int confsize; + unsigned int unused; + module_GetConfig( p_parser, &confsize ); + for ( i = 0; i < confsize; i++ ) { + module_config_t *p_config = module_GetConfig( p_parser, &unused ) + i; /* Hack: required subcategory is stored in i_min */ if( p_config->i_type == CONFIG_SUBCATEGORY && - p_config->i_value == p_item->i_min ) + p_config->value.i == p_item->min.i ) { NSString *o_description = [[VLCMain sharedInstance] - localizedString: p_parser->psz_longname]; + localizedString: module_GetLongName( p_parser )]; [o_popup addItemWithTitle: o_description]; - if( p_item->psz_value && !strcmp(p_item->psz_value, - p_parser->psz_object_name) ) + if( p_item->value.psz && !strcmp(p_item->value.psz, + module_GetObjName( p_parser )) ) [o_popup selectItem:[o_popup lastItem]]; } - } while( p_config->i_type != CONFIG_HINT_END && p_config++ ); + } } } vlc_list_release( p_list ); @@ -1362,50 +1357,52 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); { NSString *newval = [o_popup titleOfSelectedItem]; char *returnval = NULL; - int i_index; + int i_module_index; vlc_list_t *p_list; module_t *p_parser; p_list = vlc_list_find( VLCIntf, VLC_OBJECT_MODULE, FIND_ANYWHERE ); - for( i_index = 0; i_index < p_list->i_count; i_index++ ) + for( i_module_index = 0; i_module_index < p_list->i_count; i_module_index++ ) { - p_parser = (module_t *)p_list->p_values[i_index].p_object ; + p_parser = (module_t *)p_list->p_values[i_module_index].p_object; + if( p_item->i_type == CONFIG_ITEM_MODULE ) { - if( !strcmp( p_parser->psz_capability, - p_item->psz_type ) ) + if( module_IsCapable( p_parser, p_item->psz_type ) ) { NSString *o_description = [[VLCMain sharedInstance] - localizedString: p_parser->psz_longname]; + localizedString: module_GetLongName( p_parser )]; if( [newval isEqualToString: o_description] ) { - returnval = strdup(p_parser->psz_object_name); + returnval = strdup( module_GetObjName( p_parser )); break; } } } else { - module_config_t *p_config; - if( !strcmp( p_parser->psz_object_name, "main" ) ) - continue; + int i; - p_config = p_parser->p_config; - if( p_config ) do + if( !strcmp( module_GetObjName( p_parser ), "main" ) ) + continue; + unsigned int confsize, unused; + module_GetConfig( p_parser, &confsize ); + for ( i = 0; i < confsize; i++ ) { + module_config_t *p_config = module_GetConfig( p_parser, &unused ) + i; /* Hack: required subcategory is stored in i_min */ if( p_config->i_type == CONFIG_SUBCATEGORY && - p_config->i_value == p_item->i_min ) + p_config->value.i == p_item->min.i ) { NSString *o_description = [[VLCMain sharedInstance] - localizedString: p_parser->psz_longname]; + localizedString: module_GetLongName( p_parser )]; if( [newval isEqualToString: o_description] ) { - returnval = strdup(p_parser->psz_object_name); + returnval = strdup(module_GetObjName( p_parser )); break; } } - } while( p_config->i_type != CONFIG_HINT_END && p_config++ ); + } } } vlc_list_release( p_list ); @@ -1418,7 +1415,7 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); withView: (NSView *)o_parent_view { NSRect mainFrame = [o_parent_view frame]; - NSString *o_labelString, *o_tooltip, *o_textfieldString; + NSString *o_labelString, *o_tooltip; mainFrame.size.height = 23; mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1; mainFrame.origin.x = LEFTMARGIN; @@ -1430,34 +1427,28 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); o_tooltip = [[VLCMain sharedInstance] wrapString: [[VLCMain sharedInstance] - localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP]; + localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP]; /* add the label */ if( p_item->psz_text ) o_labelString = [[VLCMain sharedInstance] - localizedString: p_item->psz_text]; + localizedString: (char *)p_item->psz_text]; else o_labelString = [NSString stringWithString:@""]; - ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString ) + ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString, o_tooltip ) [o_label setAutoresizingMask:NSViewNotSizable ]; [self addSubview: o_label]; /* build the stepper */ ADD_STEPPER( o_stepper, mainFrame, mainFrame.size.width - 19, - 0, o_tooltip, -1600, 1600) - [o_stepper setIntValue: p_item->i_value]; + 0, o_tooltip, -100000, 100000) + [o_stepper setIntValue: p_item->value.i]; [o_stepper setAutoresizingMask:NSViewMaxXMargin ]; [self addSubview: o_stepper]; - /* build the textfield */ - if( p_item->psz_value ) - o_textfieldString = [[VLCMain sharedInstance] - localizedString: p_item->psz_value]; - else - o_textfieldString = [NSString stringWithString: @""]; ADD_TEXTFIELD( o_textfield, mainFrame, mainFrame.size.width - 19 - 52, 1, 49, o_tooltip, @"" ) - [o_textfield setIntValue: p_item->i_value]; + [o_textfield setIntValue: p_item->value.i]; [o_textfield setDelegate: self]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(textfieldChanged:) @@ -1526,26 +1517,27 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); int i_index; i_view_type = CONFIG_ITEM_STRING_LIST; + o_textfieldTooltip = [[VLCMain sharedInstance] wrapString: + [[VLCMain sharedInstance] + localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP]; + /* add the label */ if( p_item->psz_text ) o_labelString = [[VLCMain sharedInstance] - localizedString: p_item->psz_text]; + localizedString: (char *)p_item->psz_text]; else o_labelString = [NSString stringWithString:@""]; - ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString ) + ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString, o_textfieldTooltip ) [o_label setAutoresizingMask:NSViewNotSizable ]; [self addSubview: o_label]; /* build the textfield */ - o_textfieldTooltip = [[VLCMain sharedInstance] wrapString: - [[VLCMain sharedInstance] - localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP]; ADD_COMBO( o_combo, mainFrame, [o_label frame].size.width, -2, 0, o_textfieldTooltip ) [o_combo setAutoresizingMask:NSViewWidthSizable ]; for( i_index = 0; i_index < p_item->i_list; i_index++ ) { - if( p_item->i_value == p_item->pi_list[i_index] ) + if( p_item->value.i == p_item->pi_list[i_index] ) { [o_combo selectItemAtIndex: i_index]; } @@ -1594,7 +1586,7 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); { if( p_item->ppsz_list_text && p_item->ppsz_list_text[i_index] ) return [[VLCMain sharedInstance] - localizedString: p_item->ppsz_list_text[i_index]]; + localizedString: (char *)p_item->ppsz_list_text[i_index]]; else return [NSString stringWithFormat: @"%i", p_item->pi_list[i_index]]; } @@ -1615,23 +1607,24 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); { i_view_type = CONFIG_ITEM_RANGED_INTEGER; + o_tooltip = [[VLCMain sharedInstance] wrapString: + [[VLCMain sharedInstance] + localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP]; + /* add the label */ if( p_item->psz_text ) o_labelString = [[VLCMain sharedInstance] - localizedString: p_item->psz_text]; + localizedString: (char *)p_item->psz_text]; else o_labelString = [NSString stringWithString:@""]; - ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString ) + ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString, o_tooltip ) [o_label setAutoresizingMask:NSViewNotSizable ]; [self addSubview: o_label]; /* build the textfield */ - o_tooltip = [[VLCMain sharedInstance] wrapString: - [[VLCMain sharedInstance] - localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP]; ADD_TEXTFIELD( o_textfield, mainFrame, [o_label frame].size.width + 2, 28, 49, o_tooltip, @"" ) - [o_textfield setIntValue: p_item->i_value]; + [o_textfield setIntValue: p_item->value.i]; [o_textfield setAutoresizingMask:NSViewMaxXMargin ]; [o_textfield setDelegate: self]; [[NSNotificationCenter defaultCenter] addObserver: self @@ -1641,16 +1634,16 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); [self addSubview: o_textfield]; /* build the mintextfield */ - ADD_LABEL( o_textfield_min, mainFrame, 12, -30, @"-8888" ) - [o_textfield_min setIntValue: p_item->i_min]; + ADD_LABEL( o_textfield_min, mainFrame, 12, -30, @"-8888", @"" ) + [o_textfield_min setIntValue: p_item->min.i]; [o_textfield_min setAutoresizingMask:NSViewMaxXMargin ]; [o_textfield_min setAlignment:NSRightTextAlignment]; [self addSubview: o_textfield_min]; /* build the maxtextfield */ ADD_LABEL( o_textfield_max, mainFrame, - mainFrame.size.width - 31, -30, @"8888" ) - [o_textfield_max setIntValue: p_item->i_max]; + mainFrame.size.width - 31, -30, @"8888", @"" ) + [o_textfield_max setIntValue: p_item->max.i]; [o_textfield_max setAutoresizingMask:NSViewMinXMargin ]; [self addSubview: o_textfield_max]; @@ -1660,8 +1653,8 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); [o_textfield_max frame].size.width - [o_textfield_max frame].size.width - 14 - [o_textfield_min frame].origin.x, o_tooltip, - p_item->i_min, p_item->i_max ) - [o_slider setIntValue: p_item->i_value]; + p_item->min.i, p_item->max.i ) + [o_slider setIntValue: p_item->value.i]; [o_slider setAutoresizingMask:NSViewWidthSizable ]; [o_slider setTarget: self]; [o_slider setAction: @selector(sliderChanged:)]; @@ -1715,7 +1708,7 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); withView: (NSView *)o_parent_view { NSRect mainFrame = [o_parent_view frame]; - NSString *o_labelString, *o_tooltip, *o_textfieldString; + NSString *o_labelString, *o_tooltip; mainFrame.size.height = 23; mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1; mainFrame.origin.x = LEFTMARGIN; @@ -1727,34 +1720,29 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); o_tooltip = [[VLCMain sharedInstance] wrapString: [[VLCMain sharedInstance] - localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP]; + localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP]; /* add the label */ if( p_item->psz_text ) o_labelString = [[VLCMain sharedInstance] - localizedString: p_item->psz_text]; + localizedString: (char *)p_item->psz_text]; else o_labelString = [NSString stringWithString:@""]; - ADD_LABEL( o_label, mainFrame, 0, -2, o_labelString ) + ADD_LABEL( o_label, mainFrame, 0, -2, o_labelString, o_tooltip ) [o_label setAutoresizingMask:NSViewNotSizable ]; [self addSubview: o_label]; /* build the stepper */ ADD_STEPPER( o_stepper, mainFrame, mainFrame.size.width - 19, - 0, o_tooltip, -1600, 1600) - [o_stepper setFloatValue: p_item->f_value]; + 0, o_tooltip, -100000, 100000) + [o_stepper setFloatValue: p_item->value.f]; [o_stepper setAutoresizingMask:NSViewMaxXMargin ]; [self addSubview: o_stepper]; /* build the textfield */ - if( p_item->psz_value ) - o_textfieldString = [[VLCMain sharedInstance] - localizedString: p_item->psz_value]; - else - o_textfieldString = [NSString stringWithString: @""]; ADD_TEXTFIELD( o_textfield, mainFrame, mainFrame.size.width - 19 - 52, 1, 49, o_tooltip, @"" ) - [o_textfield setFloatValue: p_item->f_value]; + [o_textfield setFloatValue: p_item->value.f]; [o_textfield setDelegate: self]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(textfieldChanged:) @@ -1799,7 +1787,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]; } @@ -1820,23 +1808,24 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); { i_view_type = CONFIG_ITEM_RANGED_INTEGER; + o_tooltip = [[VLCMain sharedInstance] wrapString: + [[VLCMain sharedInstance] + localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP]; + /* add the label */ if( p_item->psz_text ) o_labelString = [[VLCMain sharedInstance] - localizedString: p_item->psz_text]; + localizedString: (char *)p_item->psz_text]; else o_labelString = [NSString stringWithString:@""]; - ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString ) + ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString, o_tooltip ) [o_label setAutoresizingMask:NSViewNotSizable ]; [self addSubview: o_label]; /* build the textfield */ - o_tooltip = [[VLCMain sharedInstance] wrapString: - [[VLCMain sharedInstance] - localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP]; ADD_TEXTFIELD( o_textfield, mainFrame, [o_label frame].size.width + 2, 28, 49, o_tooltip, @"" ) - [o_textfield setFloatValue: p_item->f_value]; + [o_textfield setFloatValue: p_item->value.f]; [o_textfield setAutoresizingMask:NSViewMaxXMargin ]; [o_textfield setDelegate: self]; [[NSNotificationCenter defaultCenter] addObserver: self @@ -1846,16 +1835,16 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); [self addSubview: o_textfield]; /* build the mintextfield */ - ADD_LABEL( o_textfield_min, mainFrame, 12, -30, @"-8888" ) - [o_textfield_min setFloatValue: p_item->f_min]; + ADD_LABEL( o_textfield_min, mainFrame, 12, -30, @"-8888", @"" ) + [o_textfield_min setFloatValue: p_item->min.f]; [o_textfield_min setAutoresizingMask:NSViewMaxXMargin ]; [o_textfield_min setAlignment:NSRightTextAlignment]; [self addSubview: o_textfield_min]; /* build the maxtextfield */ ADD_LABEL( o_textfield_max, mainFrame, mainFrame.size.width - 31, - -30, @"8888" ) - [o_textfield_max setFloatValue: p_item->f_max]; + -30, @"8888", @"" ) + [o_textfield_max setFloatValue: p_item->max.f]; [o_textfield_max setAutoresizingMask:NSViewMinXMargin ]; [self addSubview: o_textfield_max]; @@ -1864,9 +1853,9 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); [o_textfield_min frame].size.width + 6, -1, mainFrame.size.width - [o_textfield_max frame].size.width - [o_textfield_max frame].size.width - 14 - - [o_textfield_min frame].origin.x, o_tooltip, p_item->f_min, - p_item->f_max ) - [o_slider setFloatValue: p_item->f_value]; + [o_textfield_min frame].origin.x, o_tooltip, p_item->min.f, + p_item->max.f ) + [o_slider setFloatValue: p_item->value.f]; [o_slider setAutoresizingMask:NSViewWidthSizable ]; [o_slider setTarget: self]; [o_slider setAction: @selector(sliderChanged:)]; @@ -1909,7 +1898,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]; } @@ -1932,201 +1921,41 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); { i_view_type = CONFIG_ITEM_BOOL; - /* 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 ) - [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) + localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP]; + ADD_CHECKBOX( o_checkbox, mainFrame, 0, + 0, @"", o_tooltip, p_item->value.i, 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]; - [super dealloc]; -} - -- (int)intValue -{ - return [o_checkbox intValue]; -} - -@end - -@implementation KeyConfigControlBefore103 - -- (id) initWithItem: (module_config_t *)_p_item - withView: (NSView *)o_parent_view -{ - NSRect mainFrame = [o_parent_view frame]; - NSString *o_labelString, *o_tooltip; - mainFrame.size.height = 37; - mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1; - mainFrame.origin.x = LEFTMARGIN; - mainFrame.origin.y = 0; - - if( [super initWithFrame: mainFrame item: _p_item] != nil ) - { - i_view_type = CONFIG_ITEM_KEY_BEFORE_10_3; - /* add the label */ if( p_item->psz_text ) o_labelString = [[VLCMain sharedInstance] - localizedString: p_item->psz_text]; + localizedString: (char *)p_item->psz_text]; else o_labelString = [NSString stringWithString:@""]; - ADD_LABEL( o_label, mainFrame, 0, -10, o_labelString ) + ADD_LABEL( o_label, mainFrame, [o_checkbox frame].size.width, 0, o_labelString, o_tooltip ) [o_label setAutoresizingMask:NSViewNotSizable ]; [self addSubview: o_label]; - - /* add the checkboxes */ - o_tooltip = [[VLCMain sharedInstance] wrapString: - [[VLCMain sharedInstance] - localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP]; - ADD_CHECKBOX( o_cmd_checkbox, mainFrame, - [o_label frame].size.width + 2, 0, - [NSString stringWithUTF8String:PLACE_OF_INTEREST_SIGN], o_tooltip, - ((((unsigned int)p_item->i_value) & KEY_MODIFIER_COMMAND)?YES:NO), - NSImageLeft ) - [o_cmd_checkbox setState: p_item->i_value & KEY_MODIFIER_COMMAND]; - ADD_CHECKBOX( o_ctrl_checkbox, mainFrame, - [o_cmd_checkbox frame].size.width + - [o_cmd_checkbox frame].origin.x + 6, 0, - [NSString stringWithUTF8String:UP_ARROWHEAD], o_tooltip, - ((((unsigned int)p_item->i_value) & KEY_MODIFIER_CTRL)?YES:NO), - NSImageLeft ) - [o_ctrl_checkbox setState: p_item->i_value & KEY_MODIFIER_CTRL]; - ADD_CHECKBOX( o_alt_checkbox, mainFrame, [o_label frame].size.width + - 2, -2 - [o_cmd_checkbox frame].size.height, - [NSString stringWithUTF8String:OPTION_KEY], o_tooltip, - ((((unsigned int)p_item->i_value) & KEY_MODIFIER_ALT)?YES:NO), - NSImageLeft ) - [o_alt_checkbox setState: p_item->i_value & KEY_MODIFIER_ALT]; - ADD_CHECKBOX( o_shift_checkbox, mainFrame, - [o_cmd_checkbox frame].size.width + - [o_cmd_checkbox frame].origin.x + 6, -2 - - [o_cmd_checkbox frame].size.height, - [NSString stringWithUTF8String:UPWARDS_WHITE_ARROW], o_tooltip, - ((((unsigned int)p_item->i_value) & KEY_MODIFIER_SHIFT)?YES:NO), - NSImageLeft ) - [o_shift_checkbox setState: p_item->i_value & KEY_MODIFIER_SHIFT]; - [self addSubview: o_cmd_checkbox]; - [self addSubview: o_ctrl_checkbox]; - [self addSubview: o_alt_checkbox]; - [self addSubview: o_shift_checkbox]; - - /* build the popup */ - ADD_POPUP( o_popup, mainFrame, [o_shift_checkbox frame].origin.x + - [o_shift_checkbox frame].size.width + 4, - 4, 0, o_tooltip ) - [o_popup setAutoresizingMask:NSViewWidthSizable ]; - - if( o_keys_menu == nil ) - { - unsigned int i; - o_keys_menu = [[NSMenu alloc] initWithTitle: @"Keys Menu"]; - for ( i = 0; i < sizeof(vlc_keys) / sizeof(key_descriptor_t); i++) - if( vlc_keys[i].psz_key_string && *vlc_keys[i].psz_key_string ) - POPULATE_A_KEY( o_keys_menu, - [NSString stringWithCString:vlc_keys[i].psz_key_string] - , vlc_keys[i].i_key_code) - } - [o_popup setMenu:[o_keys_menu copyWithZone:nil]]; - [o_popup selectItemWithTitle: [[VLCMain sharedInstance] - localizedString:KeyToString( - (((unsigned int)p_item->i_value) & ~KEY_MODIFIER ))]]; - [self addSubview: o_popup]; } return self; } -- (void) alignWithXPosition:(int)i_xPos -{ - NSRect frame; - NSRect superFrame = [self frame]; - frame = [o_label frame]; - frame.origin.x = i_xPos - frame.size.width - 3; - [o_label setFrame:frame]; - - frame = [o_cmd_checkbox frame]; - frame.origin.x = i_xPos; - [o_cmd_checkbox setFrame:frame]; - - frame = [o_ctrl_checkbox frame]; - frame.origin.x = [o_cmd_checkbox frame].size.width + - [o_cmd_checkbox frame].origin.x + 4; - [o_ctrl_checkbox setFrame:frame]; - - frame = [o_alt_checkbox frame]; - frame.origin.x = i_xPos; - [o_alt_checkbox setFrame:frame]; - - frame = [o_shift_checkbox frame]; - frame.origin.x = [o_cmd_checkbox frame].size.width + - [o_cmd_checkbox frame].origin.x + 4; - [o_shift_checkbox setFrame:frame]; - - frame = [o_popup frame]; - frame.origin.x = [o_shift_checkbox frame].origin.x + - [o_shift_checkbox frame].size.width + 3; - frame.size.width = superFrame.size.width - frame.origin.x + 2; - [o_popup setFrame:frame]; -} - - (void)dealloc { - [o_cmd_checkbox release]; - [o_ctrl_checkbox release]; - [o_alt_checkbox release]; - [o_shift_checkbox release]; - [o_popup release]; + [o_checkbox release]; [super dealloc]; } - (int)intValue { - unsigned int i_new_key = 0; - - i_new_key |= ([o_cmd_checkbox state] == NSOnState) ? - KEY_MODIFIER_COMMAND : 0; - i_new_key |= ([o_ctrl_checkbox state] == NSOnState) ? - KEY_MODIFIER_CTRL : 0; - i_new_key |= ([o_alt_checkbox state] == NSOnState) ? - KEY_MODIFIER_ALT : 0; - i_new_key |= ([o_shift_checkbox state] == NSOnState) ? - KEY_MODIFIER_SHIFT : 0; - - i_new_key |= StringToKey([[[o_popup selectedItem] title] cString]); - return i_new_key; + return [o_checkbox intValue]; } + @end -@implementation KeyConfigControlAfter103 +@implementation KeyConfigControl - (id) initWithItem: (module_config_t *)_p_item withView: (NSView *)o_parent_view { @@ -2141,20 +1970,21 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); { i_view_type = CONFIG_ITEM_KEY_AFTER_10_3; + o_tooltip = [[VLCMain sharedInstance] wrapString: + [[VLCMain sharedInstance] + localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP]; + /* add the label */ if( p_item->psz_text ) o_labelString = [[VLCMain sharedInstance] - localizedString: p_item->psz_text]; + localizedString: (char *)p_item->psz_text]; else o_labelString = [NSString stringWithString:@""]; - ADD_LABEL( o_label, mainFrame, 0, -1, o_labelString ) + ADD_LABEL( o_label, mainFrame, 0, -1, o_labelString, o_tooltip ) [o_label setAutoresizingMask:NSViewNotSizable ]; [self addSubview: o_label]; /* build the popup */ - o_tooltip = [[VLCMain sharedInstance] wrapString: - [[VLCMain sharedInstance] - localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP]; ADD_POPUP( o_popup, mainFrame, [o_label frame].origin.x + [o_label frame].size.width + 3, -2, 0, o_tooltip ) @@ -2165,13 +1995,13 @@ fprintf( stderr, "Applying %f to %s\n" , [self floatValue], psz_name ); unsigned int i; o_keys_menu = [[NSMenu alloc] initWithTitle: @"Keys Menu"]; for ( i = 0; i < sizeof(vlc_keys) / sizeof(key_descriptor_t); i++) - if( vlc_keys[i].psz_key_string && *vlc_keys[i].psz_key_string ) + if( vlc_keys[i].psz_key_string ) POPULATE_A_KEY( o_keys_menu, - [NSString stringWithCString:vlc_keys[i].psz_key_string] + [NSString stringWithUTF8String:vlc_keys[i].psz_key_string] , vlc_keys[i].i_key_code) } [o_popup setMenu:[o_keys_menu copyWithZone:nil]]; - [o_popup selectItem:[[o_popup menu] itemWithTag:p_item->i_value]]; + [o_popup selectItem:[[o_popup menu] itemWithTag:p_item->value.i]]; [self addSubview: o_popup]; } @@ -2215,36 +2045,42 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST ) //Fill our array to know how may items we have... vlc_list_t *p_list; module_t *p_parser; - int i_index; + int i_module_index; NSRect mainFrame = [o_parent_view frame]; NSString *o_labelString, *o_textfieldString, *o_tooltip; o_modulearray = [[NSMutableArray alloc] initWithCapacity:10]; /* build a list of available modules */ p_list = vlc_list_find( VLCIntf, VLC_OBJECT_MODULE, FIND_ANYWHERE ); - for( i_index = 0; i_index < p_list->i_count; i_index++ ) + for( i_module_index = 0; i_module_index < p_list->i_count; i_module_index++ ) { - p_parser = (module_t *)p_list->p_values[i_index].p_object ; + int i; + p_parser = (module_t *)p_list->p_values[i_module_index].p_object; - if( !strcmp( p_parser->psz_object_name, "main" ) ) + if( !strcmp( module_GetObjName( p_parser ), "main" ) ) continue; - module_config_t *p_config = p_parser->p_config; - if( p_config ) do + unsigned int confsize; + module_GetConfig( p_parser, &confsize ); + + for ( i = 0; i < confsize; i++ ) { + unsigned int unused; + module_config_t *p_config = module_GetConfig( p_parser, &unused ) + i; NSString *o_modulelongname, *o_modulename; NSNumber *o_moduleenabled = nil; + /* Hack: required subcategory is stored in i_min */ if( p_config->i_type == CONFIG_SUBCATEGORY && - p_config->i_value == _p_item->i_min ) + p_config->value.i == _p_item->min.i ) { o_modulelongname = [NSString stringWithUTF8String: - p_parser->psz_longname]; + module_GetLongName( p_parser )]; o_modulename = [NSString stringWithUTF8String: - p_parser->psz_object_name]; + module_GetObjName( p_parser )]; - if( _p_item->psz_value && - strstr( _p_item->psz_value, p_parser->psz_object_name ) ) + if( _p_item->value.psz && + strstr( _p_item->value.psz, module_GetObjName( p_parser ) ) ) o_moduleenabled = [NSNumber numberWithBool:YES]; else o_moduleenabled = [NSNumber numberWithBool:NO]; @@ -2253,7 +2089,7 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST ) arrayWithObjects: o_modulename, o_modulelongname, o_moduleenabled, nil]]; } - } while( p_config->i_type != CONFIG_HINT_END && p_config++ ); + } } vlc_list_release( p_list ); @@ -2265,23 +2101,24 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST ) { i_view_type = CONFIG_ITEM_MODULE_LIST; + o_tooltip = [[VLCMain sharedInstance] wrapString: + [[VLCMain sharedInstance] + localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP]; + /* add the label */ if( p_item->psz_text ) o_labelString = [[VLCMain sharedInstance] - localizedString: p_item->psz_text]; + localizedString: (char *)p_item->psz_text]; else o_labelString = [NSString stringWithString:@""]; - ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString ) + ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString, o_tooltip ) [o_label setAutoresizingMask:NSViewNotSizable ]; [self addSubview: o_label]; /* build the textfield */ - o_tooltip = [[VLCMain sharedInstance] wrapString: - [[VLCMain sharedInstance] - localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP]; - if( p_item->psz_value ) + if( p_item->value.psz ) o_textfieldString = [[VLCMain sharedInstance] - localizedString: p_item->psz_value]; + localizedString: (char *)p_item->value.psz]; else o_textfieldString = [NSString stringWithString: @""]; ADD_TEXTFIELD( o_textfield, mainFrame, [o_label frame].size.width + 2, @@ -2316,7 +2153,7 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST ) [o_dataCell setTitle:@""]; [o_dataCell setFont:[NSFont systemFontOfSize:0]]; NSTableColumn *o_tableColumn = [[NSTableColumn alloc] - initWithIdentifier:[NSString stringWithCString: "Enabled"]]; + initWithIdentifier:@"Enabled"]; [o_tableColumn setHeaderCell: o_headerCell]; [o_tableColumn setDataCell: o_dataCell]; [o_tableColumn setWidth:17]; @@ -2326,7 +2163,7 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST ) o_dataCell = [[NSTextFieldCell alloc] init]; [o_dataCell setFont:[NSFont systemFontOfSize:12]]; o_tableColumn = [[NSTableColumn alloc] - initWithIdentifier:[NSString stringWithCString: "Module"]]; + initWithIdentifier:@"Module"]; [o_tableColumn setHeaderCell: o_headerCell]; [o_tableColumn setDataCell: o_dataCell]; [o_tableColumn setWidth:388 - 17]; @@ -2364,7 +2201,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 @@ -2380,7 +2217,7 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST ) - (char *)stringValue { - return strdup( [[o_textfield stringValue] cString] ); + return strdup( [[o_textfield stringValue] UTF8String] ); } @end @@ -2486,11 +2323,9 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST ) - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex { - if( [[aTableColumn identifier] isEqualToString: - [NSString stringWithCString:"Enabled"]] ) + if( [[aTableColumn identifier] isEqualToString: @"Enabled"] ) return [[o_modulearray objectAtIndex:rowIndex] objectAtIndex:2]; - if( [[aTableColumn identifier] isEqualToString: - [NSString stringWithCString:"Module"]] ) + if( [[aTableColumn identifier] isEqualToString: @"Module"] ) return [[o_modulearray objectAtIndex:rowIndex] objectAtIndex:1]; return nil;