/*****************************************************************************
* prefs_widgets.m: Preferences controls
*****************************************************************************
- * Copyright (C) 2002-2007 the VideoLAN team
+ * Copyright (C) 2002-2011 the VideoLAN team
* $Id$
*
* Authors: Derk-Jan Hartman <hartman at videolan.org>
#endif
#include <vlc_common.h>
-#include "vlc_keys.h"
+#include <vlc_modules.h>
+#include <vlc_keys.h>
#include "intf.h"
#include "prefs_widgets.h"
case CONFIG_ITEM_STRING_LIST:
i_margin = 7;
break;
- case CONFIG_ITEM_FILE:
+ case CONFIG_ITEM_LOADFILE:
+ case CONFIG_ITEM_SAVEFILE:
i_margin = 8;
break;
case CONFIG_ITEM_MODULE:
case CONFIG_ITEM_BOOL:
i_margin = 7;
break;
- case CONFIG_ITEM_KEY_AFTER_10_3:
+ case CONFIG_ITEM_KEY:
i_margin = 6;
break;
case CONFIG_ITEM_MODULE_LIST:
case CONFIG_ITEM_STRING_LIST:
i_margin = 7;
break;
- case CONFIG_ITEM_FILE:
+ case CONFIG_ITEM_LOADFILE:
+ case CONFIG_ITEM_SAVEFILE:
i_margin = 6;
break;
case CONFIG_ITEM_MODULE:
case CONFIG_ITEM_BOOL:
i_margin = 7;
break;
- case CONFIG_ITEM_KEY_AFTER_10_3:
+ case CONFIG_ITEM_KEY:
i_margin = 6;
break;
case CONFIG_ITEM_MODULE_LIST:
break;
}
break;
- case CONFIG_ITEM_FILE:
+ case CONFIG_ITEM_LOADFILE:
+ case CONFIG_ITEM_SAVEFILE:
switch( i_lastItem )
{
case CONFIG_ITEM_STRING:
case CONFIG_ITEM_STRING_LIST:
i_margin = 10;
break;
- case CONFIG_ITEM_FILE:
+ case CONFIG_ITEM_LOADFILE:
+ case CONFIG_ITEM_SAVEFILE:
i_margin = 9;
break;
case CONFIG_ITEM_MODULE:
case CONFIG_ITEM_BOOL:
i_margin = 10;
break;
- case CONFIG_ITEM_KEY_AFTER_10_3:
+ case CONFIG_ITEM_KEY:
i_margin = 9;
break;
case CONFIG_ITEM_MODULE_LIST:
case CONFIG_ITEM_STRING_LIST:
i_margin = 7;
break;
- case CONFIG_ITEM_FILE:
+ case CONFIG_ITEM_LOADFILE:
+ case CONFIG_ITEM_SAVEFILE:
i_margin = 6;
break;
case CONFIG_ITEM_MODULE:
case CONFIG_ITEM_BOOL:
i_margin = 8;
break;
- case CONFIG_ITEM_KEY_AFTER_10_3:
+ case CONFIG_ITEM_KEY:
i_margin = 7;
break;
case CONFIG_ITEM_MODULE_LIST:
case CONFIG_ITEM_STRING_LIST:
i_margin = 7;
break;
- case CONFIG_ITEM_FILE:
+ case CONFIG_ITEM_LOADFILE:
+ case CONFIG_ITEM_SAVEFILE:
i_margin = 6;
break;
case CONFIG_ITEM_MODULE:
case CONFIG_ITEM_BOOL:
i_margin = 7;
break;
- case CONFIG_ITEM_KEY_AFTER_10_3:
+ case CONFIG_ITEM_KEY:
i_margin = 6;
break;
case CONFIG_ITEM_MODULE_LIST:
case CONFIG_ITEM_STRING_LIST:
i_margin = 7;
break;
- case CONFIG_ITEM_FILE:
+ case CONFIG_ITEM_LOADFILE:
+ case CONFIG_ITEM_SAVEFILE:
i_margin = 8;
break;
case CONFIG_ITEM_MODULE:
case CONFIG_ITEM_BOOL:
i_margin = 7;
break;
- case CONFIG_ITEM_KEY_AFTER_10_3:
+ case CONFIG_ITEM_KEY:
i_margin = 6;
break;
case CONFIG_ITEM_MODULE_LIST:
case CONFIG_ITEM_STRING_LIST:
i_margin = 9;
break;
- case CONFIG_ITEM_FILE:
+ case CONFIG_ITEM_LOADFILE:
+ case CONFIG_ITEM_SAVEFILE:
i_margin = 8;
break;
case CONFIG_ITEM_MODULE:
case CONFIG_ITEM_BOOL:
i_margin = 7;
break;
- case CONFIG_ITEM_KEY_AFTER_10_3:
+ case CONFIG_ITEM_KEY:
i_margin = 5;
break;
case CONFIG_ITEM_MODULE_LIST:
break;
}
break;
- case CONFIG_ITEM_KEY_AFTER_10_3:
+ case CONFIG_ITEM_KEY:
switch( i_lastItem )
{
case CONFIG_ITEM_STRING:
case CONFIG_ITEM_STRING_LIST:
i_margin = 7;
break;
- case CONFIG_ITEM_FILE:
+ case CONFIG_ITEM_LOADFILE:
+ case CONFIG_ITEM_SAVEFILE:
i_margin = 6;
break;
case CONFIG_ITEM_MODULE:
case CONFIG_ITEM_BOOL:
i_margin = 7;
break;
- case CONFIG_ITEM_KEY_AFTER_10_3:
+ case CONFIG_ITEM_KEY:
i_margin = 8;
break;
case CONFIG_ITEM_MODULE_LIST:
case CONFIG_ITEM_STRING_LIST:
i_margin = 7;
break;
- case CONFIG_ITEM_FILE:
+ case CONFIG_ITEM_LOADFILE:
+ case CONFIG_ITEM_SAVEFILE:
i_margin = 6;
break;
case CONFIG_ITEM_MODULE:
case CONFIG_ITEM_BOOL:
i_margin = 7;
break;
- case CONFIG_ITEM_KEY_AFTER_10_3:
+ case CONFIG_ITEM_KEY:
i_margin = 5;
break;
case CONFIG_ITEM_MODULE_LIST:
withView: o_parent_view];
}
break;
- case CONFIG_ITEM_FILE:
+ case CONFIG_ITEM_LOADFILE:
+ case CONFIG_ITEM_SAVEFILE:
case CONFIG_ITEM_DIRECTORY:
p_control = [[FileConfigControl alloc]
initWithItem: _p_item
initWithItem: _p_item
withView: o_parent_view];
}
- else if( _p_item->min.i != 0 || _p_item->max.i != 0 )
+ else if( (_p_item->min.i != 0 || _p_item->max.i != 0) && (_p_item->min.i != INT_MIN || _p_item->max.i != INT_MAX) )
{
p_control = [[RangedIntegerConfigControl alloc]
initWithItem: _p_item
withView: o_parent_view];
break;
case CONFIG_ITEM_FLOAT:
- if( _p_item->min.f != 0 || _p_item->max.f != 0 )
+ if( (_p_item->min.i != 0 || _p_item->max.i != 0) && (_p_item->min.i != INT_MIN || _p_item->max.i != INT_MAX) )
{
p_control = [[RangedFloatConfigControl alloc]
initWithItem: _p_item
withView: o_parent_view];
}
break;
+ /* don't display keys in the advanced settings, since the current controls
+ are broken by design. The user is required to change hotkeys in the sprefs
+ and can only change really advanced stuff here..
case CONFIG_ITEM_KEY:
p_control = [[KeyConfigControl alloc]
initWithItem: _p_item
withView: o_parent_view];
- break;
+ break; */
case CONFIG_ITEM_MODULE_LIST:
case CONFIG_ITEM_MODULE_LIST_CAT:
p_control = [[ModuleListConfigControl alloc]
{
case CONFIG_ITEM_STRING:
case CONFIG_ITEM_PASSWORD:
- case CONFIG_ITEM_FILE:
+ case CONFIG_ITEM_LOADFILE:
+ case CONFIG_ITEM_SAVEFILE:
case CONFIG_ITEM_DIRECTORY:
case CONFIG_ITEM_MODULE:
case CONFIG_ITEM_MODULE_LIST:
}
}
+- (void)resetValues
+{
+}
+
- (int)labelSize
{
return [o_label frame].size.width;
- (char *)stringValue
{
- return strdup( [[VLCMain sharedInstance] delocalizeString:
- [o_textfield stringValue]] );
+ return [[VLCMain sharedInstance] delocalizeString:
+ [o_textfield stringValue]];
+}
+
+- (void)resetValues
+{
+ NSString *o_textfieldString;
+ char *psz_value = config_GetPsz( VLCIntf, p_item->psz_name );
+ if( psz_value )
+ o_textfieldString = [[VLCMain sharedInstance]
+ localizedString: psz_value];
+ else
+ o_textfieldString = [NSString stringWithString: @""];
+ free( psz_value );
+ [super resetValues];
}
@end
-2, 0, o_textfieldTooltip )
[o_combo setAutoresizingMask:NSViewWidthSizable ];
for( i_index = 0; i_index < p_item->i_list; i_index++ )
- if( p_item->value.psz &&
+ {
+ if( !p_item->value.psz && !p_item->ppsz_list[i_index] )
+ [o_combo selectItemAtIndex: i_index];
+ else if( p_item->value.psz && p_item->ppsz_list[i_index] &&
!strcmp( p_item->value.psz, p_item->ppsz_list[i_index] ) )
[o_combo selectItemAtIndex: i_index];
+ }
[self addSubview: o_combo];
}
return self;
- (char *)stringValue
{
- if( [o_combo indexOfSelectedItem] >= 0 )
- return strdup( p_item->ppsz_list[[o_combo indexOfSelectedItem]] );
- else
- return strdup( [[VLCMain sharedInstance]
- delocalizeString: [o_combo stringValue]] );
+ if( [o_combo indexOfSelectedItem] >= 0 ) {
+ if( p_item->ppsz_list[[o_combo indexOfSelectedItem]] != NULL )
+ return strdup( p_item->ppsz_list[[o_combo indexOfSelectedItem]] );
+ } else {
+ if( [[VLCMain sharedInstance] delocalizeString: [o_combo stringValue]] != NULL )
+ return strdup( [[VLCMain sharedInstance] delocalizeString: [o_combo stringValue]] );
+ }
+ return NULL;
+}
+
+- (void)resetValues
+{
+ int i_index;
+ [o_combo reloadData];
+ char *psz_value = config_GetPsz( VLCIntf, p_item->psz_name );
+
+ for( i_index = 0; i_index < p_item->i_list; i_index++ )
+ {
+ if( !psz_value && !p_item->ppsz_list[i_index] )
+ [o_combo selectItemAtIndex: i_index];
+ else if( psz_value && p_item->ppsz_list[i_index] &&
+ !strcmp( psz_value, p_item->ppsz_list[i_index] ) )
+ [o_combo selectItemAtIndex: i_index];
+ }
+
+ free( psz_value );
+ [super resetValues];
}
@end
if( [super initWithFrame: mainFrame item: _p_item] != nil )
{
- i_view_type = CONFIG_ITEM_FILE;
+ i_view_type = CONFIG_ITEM_LOADFILE;
o_itemTooltip = [[VLCMain sharedInstance]
wrapString: [[VLCMain sharedInstance]
{
if( i_return_code == NSOKButton )
{
- NSString *o_path = [[o_sheet filenames] objectAtIndex: 0];
+ NSString *o_path = [[[o_sheet URLs] objectAtIndex: 0] path];
[o_textfield setStringValue: o_path];
}
}
else
return NULL;
}
+
+-(void)resetValues
+{
+ NSString *o_textfieldString;
+ char *psz_value = config_GetPsz( VLCIntf, p_item->psz_name );
+ if( psz_value )
+ o_textfieldString = [NSString stringWithFormat: @"%s", psz_value];
+ else
+ o_textfieldString = [NSString stringWithString: @""];
+
+ free(psz_value);
+ [super resetValues];
+}
@end
@implementation ModuleConfigControl
if( [super initWithFrame: mainFrame item: _p_item] != nil )
{
- size_t i_index;
- module_t *p_parser, **p_list;
i_view_type = CONFIG_ITEM_MODULE;
o_popupTooltip = [[VLCMain sharedInstance] wrapString:
[[o_popup lastItem] setTag: -1];
[o_popup selectItem: [o_popup lastItem]];
- /* build a list of available modules */
- p_list = module_list_get( NULL );
- for( i_index = 0; p_list[i_index]; i_index++ )
- {
- p_parser = p_list[i_index];
-
- if( p_item->i_type == CONFIG_ITEM_MODULE )
- {
- if( module_provides( p_parser, p_item->psz_type ) )
- {
- NSString *o_description = [[VLCMain sharedInstance]
- localizedString: module_GetLongName( p_parser )];
- [o_popup addItemWithTitle: o_description];
-
- if( p_item->value.psz &&
- !strcmp( p_item->value.psz, module_get_object( p_parser ) ) )
- [o_popup selectItem:[o_popup lastItem]];
- }
- }
- else
- {
- int i;
-
- if( module_is_main( p_parser ) )
- continue;
- unsigned int confsize;
- unsigned int unused;
- module_config_get( p_parser, &confsize );
- for ( i = 0; i < confsize; i++ )
- {
- module_config_t *p_config = module_config_get( p_parser, &unused ) + i;
- /* Hack: required subcategory is stored in i_min */
- if( p_config->i_type == CONFIG_SUBCATEGORY &&
- p_config->value.i == p_item->min.i )
- {
- NSString *o_description = [[VLCMain sharedInstance]
- localizedString: module_GetLongName( p_parser )];
- [o_popup addItemWithTitle: o_description];
-
- if( p_item->value.psz && !strcmp(p_item->value.psz,
- module_get_object( p_parser )) )
- [o_popup selectItem:[o_popup lastItem]];
- }
- }
- }
- }
- module_list_free( p_list );
+ [self resetValues];
[self addSubview: o_popup];
}
return self;
if( module_provides( p_parser, p_item->psz_type ) )
{
NSString *o_description = [[VLCMain sharedInstance]
- localizedString: module_GetLongName( p_parser )];
+ localizedString: module_get_name( p_parser, TRUE )];
if( [newval isEqualToString: o_description] )
{
returnval = strdup( module_get_object( p_parser ));
if( module_is_main( p_parser) )
continue;
unsigned int confsize, unused;
- module_config_get( p_parser, &confsize );
+ module_config_t *p_config = module_config_get( p_parser, &confsize );
for ( i = 0; i < confsize; i++ )
{
- module_config_t *p_config = module_config_get( p_parser, &unused ) + i;
+ module_config_t *p_item = p_config + i;
/* Hack: required subcategory is stored in i_min */
- if( p_config->i_type == CONFIG_SUBCATEGORY &&
- p_config->value.i == p_item->min.i )
+ if( p_item->i_type == CONFIG_SUBCATEGORY &&
+ p_item->value.i == p_item->min.i )
{
NSString *o_description = [[VLCMain sharedInstance]
- localizedString: module_GetLongName( p_parser )];
+ localizedString: module_get_name( p_parser, TRUE )];
if( [newval isEqualToString: o_description] )
{
returnval = strdup(module_get_object( p_parser ));
}
}
}
+ module_config_free( p_config );
}
}
module_list_free( p_list );
return returnval;
}
+
+-(void)resetValues
+{
+ /* build a list of available modules */
+ size_t i_index;
+ module_t *p_parser, **p_list;
+
+ p_list = module_list_get( NULL );
+ for( i_index = 0; p_list[i_index]; i_index++ )
+ {
+ p_parser = p_list[i_index];
+
+ if( p_item->i_type == CONFIG_ITEM_MODULE )
+ {
+ if( module_provides( p_parser, p_item->psz_type ) )
+ {
+ NSString *o_description = [[VLCMain sharedInstance]
+ localizedString: module_get_name( p_parser, TRUE )];
+ [o_popup addItemWithTitle: o_description];
+ char *psz_value = config_GetPsz( VLCIntf, p_item->psz_name );
+
+ if( psz_value &&
+ !strcmp( psz_value, module_get_object( p_parser ) ) )
+ [o_popup selectItem:[o_popup lastItem]];
+
+ free(psz_value);
+ }
+ }
+ else
+ {
+ int i;
+
+ if( module_is_main( p_parser ) )
+ continue;
+ unsigned int confsize;
+ unsigned int unused;
+ module_config_t *p_configlist = module_config_get( p_parser, &confsize );
+ for ( i = 0; i < confsize; i++ )
+ {
+ module_config_t *p_config = &p_configlist[i];
+ /* Hack: required subcategory is stored in i_min */
+ if( p_config->i_type == CONFIG_SUBCATEGORY &&
+ config_GetInt( VLCIntf, p_item->psz_name) == p_item->min.i )
+ {
+ NSString *o_description = [[VLCMain sharedInstance]
+ localizedString: module_get_name( p_parser, TRUE )];
+ [o_popup addItemWithTitle: o_description];
+ char *psz_value = config_GetPsz( VLCIntf, p_item->psz_name );
+
+ if( psz_value && !strcmp(psz_value,
+ module_get_object( p_parser )) )
+ [o_popup selectItem:[o_popup lastItem]];
+
+ free( psz_value );
+ }
+ }
+ module_config_free( p_configlist );
+ }
+ }
+ module_list_free( p_list );
+ [super resetValues];
+}
@end
@implementation IntegerConfigControl
return [o_textfield intValue];
}
+-(void)resetValues
+{
+ [o_textfield setIntValue: config_GetInt(VLCIntf, p_item->psz_name)];
+ [super resetValues];
+}
+
@end
@implementation IntegerListConfigControl
else
return [o_combo intValue];
}
+
+-(void)resetValues
+{
+ int i_index;
+ [o_combo reloadData];
+ for( i_index = 0; i_index < p_item->i_list; i_index++ )
+ {
+ if( config_GetInt( VLCIntf, p_item->psz_name) == p_item->pi_list[i_index] )
+ {
+ [o_combo selectItemAtIndex: i_index];
+ }
+ }
+
+}
@end
@implementation IntegerListConfigControl (NSComboBoxDataSource)
{
return [o_slider intValue];
}
+
+- (void)resetValues
+{
+ int value = config_GetInt( VLCIntf, p_item->psz_name );
+ [o_textfield setIntValue:value];
+ [o_slider setIntValue:value];
+ [super resetValues];
+}
@end
@implementation FloatConfigControl
{
return [o_stepper floatValue];
}
+
+- (void)resetValues
+{
+ [o_textfield setFloatValue: config_GetFloat( VLCIntf, p_item->psz_name)];
+ [super resetValues];
+}
@end
@implementation RangedFloatConfigControl
return [o_slider floatValue];
}
+- (void)resetValues
+{
+ [o_textfield setFloatValue: config_GetFloat(VLCIntf, p_item->psz_name)];
+ [o_slider setFloatValue: config_GetFloat(VLCIntf, p_item->psz_name)];
+ [super resetValues];
+}
@end
@implementation BoolConfigControl
return [o_checkbox intValue];
}
+- (void)resetValues
+{
+ [o_checkbox setState: config_GetInt( VLCIntf, p_item->psz_name)];
+ [super resetValues];
+}
@end
@implementation KeyConfigControl
if( [super initWithFrame: mainFrame item: _p_item] != nil )
{
- i_view_type = CONFIG_ITEM_KEY_AFTER_10_3;
+ i_view_type = CONFIG_ITEM_KEY;
o_tooltip = [[VLCMain sharedInstance] wrapString:
[[VLCMain sharedInstance]
{
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 )
+#warning This does not work anymore. FIXME.
+#if 0
+ for ( i = 0; i < sizeof(vlc_key) / sizeof(key_descriptor_t); i++)
+ if( vlc_key[i].psz_key_string )
POPULATE_A_KEY( o_keys_menu,
- [NSString stringWithUTF8String:vlc_keys[i].psz_key_string]
- , vlc_keys[i].i_key_code)
+ [NSString stringWithUTF8String:vlc_key[i].psz_key_string]
+ , vlc_key[i].i_key_code)
+#endif
}
[o_popup setMenu:[o_keys_menu copyWithZone:nil]];
[o_popup selectItem:[[o_popup menu] itemWithTag:p_item->value.i]];
{
return [o_popup selectedTag];
}
+
+- (void)resetValues
+{
+ [o_popup selectItem:[[o_popup menu] itemWithTag:config_GetInt( VLCIntf, p_item->psz_name )]];
+ [super resetValues];
+}
@end
@implementation ModuleListConfigControl
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
{
-if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST )
-//TODO....
+ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST )
+ //TODO....
return nil;
-
-//Fill our array to know how may items we have...
+
+ //Fill our array to know how may items we have...
module_t *p_parser, **p_list;
size_t 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 = module_list_get( NULL );
{
int i;
p_parser = p_list[i_module_index];
-
+
if( module_is_main( p_parser ) )
continue;
-
+
unsigned int confsize;
- module_config_get( p_parser, &confsize );
-
+ module_config_t *p_configlist = module_config_get( p_parser, &confsize );
+
for ( i = 0; i < confsize; i++ )
{
unsigned int unused;
- module_config_t *p_config = module_config_get( p_parser, &unused ) + i;
+ module_config_t *p_config = &p_configlist[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->value.i == _p_item->min.i )
+ p_config->value.i == _p_item->min.i )
{
o_modulelongname = [NSString stringWithUTF8String:
- module_GetLongName( p_parser )];
+ module_get_name( p_parser, TRUE )];
o_modulename = [NSString stringWithUTF8String:
- module_get_object( p_parser )];
-
+ module_get_object( p_parser )];
+
if( _p_item->value.psz &&
- strstr( _p_item->value.psz, module_get_object( p_parser ) ) )
+ strstr( _p_item->value.psz, module_get_object( p_parser ) ) )
o_moduleenabled = [NSNumber numberWithBool:YES];
else
o_moduleenabled = [NSNumber numberWithBool:NO];
-
+
[o_modulearray addObject:[NSMutableArray
- arrayWithObjects: o_modulename, o_modulelongname,
- o_moduleenabled, nil]];
+ arrayWithObjects: o_modulename, o_modulelongname,
+ o_moduleenabled, nil]];
}
}
+ module_config_free( p_configlist );
}
module_list_free( p_list );
-
- mainFrame.size.height = 30 + 18 * [o_modulearray count];
+
+ mainFrame.size.height = 30 + 20 * [o_modulearray count];
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
mainFrame.origin.x = LEFTMARGIN;
mainFrame.origin.y = 0;
if( [super initWithFrame: mainFrame item: _p_item] != nil )
{
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: (char *)p_item->psz_text];
+ localizedString: (char *)p_item->psz_text];
else
o_labelString = [NSString stringWithString:@""];
ADD_LABEL( o_label, mainFrame, 0, -3, o_labelString, o_tooltip )
[o_label setAutoresizingMask:NSViewNotSizable ];
[self addSubview: o_label];
-
+
/* build the textfield */
if( p_item->value.psz )
o_textfieldString = [[VLCMain sharedInstance]
- localizedString: (char *)p_item->value.psz];
+ localizedString: (char *)p_item->value.psz];
else
o_textfieldString = [NSString stringWithString: @""];
ADD_TEXTFIELD( o_textfield, mainFrame, [o_label frame].size.width + 2,
- mainFrame.size.height - 22, mainFrame.size.width -
- [o_label frame].size.width - 2, o_tooltip, o_textfieldString )
+ mainFrame.size.height - 22, mainFrame.size.width -
+ [o_label frame].size.width - 2, o_tooltip, o_textfieldString )
[o_textfield setAutoresizingMask:NSViewWidthSizable ];
[self addSubview: o_textfield];
-
-
-{
- NSRect s_rc = mainFrame;
- s_rc.size.height = mainFrame.size.height - 30;
- s_rc.size.width = mainFrame.size.width - 12;
- s_rc.origin.x = 12;
- s_rc.origin.y = 0;
- o_scrollview = [[[NSScrollView alloc] initWithFrame: s_rc] retain];
- [o_scrollview setDrawsBackground: NO];
- [o_scrollview setBorderType: NSBezelBorder];
- [o_scrollview setAutohidesScrollers:YES];
-
- NSTableView *o_tableview;
- o_tableview = [[NSTableView alloc] initWithFrame : s_rc];
- [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... */
-// [o_tableview setAllowsMultipleSelection:YES];
-
- NSCell *o_headerCell = [[NSCell alloc] initTextCell:@"Enabled"];
- NSCell *o_dataCell = [[NSButtonCell alloc] init];
- [(NSButtonCell*)o_dataCell setButtonType:NSSwitchButton];
- [o_dataCell setTitle:@""];
- [o_dataCell setFont:[NSFont systemFontOfSize:0]];
- NSTableColumn *o_tableColumn = [[NSTableColumn alloc]
- initWithIdentifier:@"Enabled"];
- [o_tableColumn setHeaderCell: o_headerCell];
- [o_tableColumn setDataCell: o_dataCell];
- [o_tableColumn setWidth:17];
- [o_tableview addTableColumn: o_tableColumn];
-
- o_headerCell = [[NSCell alloc] initTextCell:@"Module Name"];
- o_dataCell = [[NSTextFieldCell alloc] init];
- [o_dataCell setFont:[NSFont systemFontOfSize:12]];
- o_tableColumn = [[NSTableColumn alloc]
- initWithIdentifier:@"Module"];
- [o_tableColumn setHeaderCell: o_headerCell];
- [o_tableColumn setDataCell: o_dataCell];
- [o_tableColumn setWidth:388 - 17];
- [o_tableview addTableColumn: o_tableColumn];
- [o_tableview registerForDraggedTypes:[NSArray arrayWithObjects:
- @"VLC media player module", nil]];
-
- [o_tableview setDataSource:self];
- [o_tableview setTarget: self];
- [o_tableview setAction: @selector(tableChanged:)];
- [o_tableview sendActionOn:NSLeftMouseUpMask | NSLeftMouseDownMask |
- NSLeftMouseDraggedMask];
- [o_scrollview setDocumentView: o_tableview];
-}
- [o_scrollview setAutoresizingMask:NSViewWidthSizable ];
- [self addSubview: o_scrollview];
-
+
+
+ {
+ NSRect s_rc = mainFrame;
+ s_rc.size.height = mainFrame.size.height - 30;
+ s_rc.size.width = mainFrame.size.width - 12;
+ s_rc.origin.x = 12;
+ s_rc.origin.y = 0;
+ o_scrollview = [[[NSScrollView alloc] initWithFrame: s_rc] retain];
+ [o_scrollview setDrawsBackground: NO];
+ [o_scrollview setBorderType: NSBezelBorder];
+ [o_scrollview setAutohidesScrollers:YES];
+
+ NSTableView *o_tableview;
+ o_tableview = [[NSTableView alloc] initWithFrame : s_rc];
+ [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... */
+ // [o_tableview setAllowsMultipleSelection:YES];
+
+ NSCell *o_headerCell = [[NSCell alloc] initTextCell:@"Enabled"];
+ NSCell *o_dataCell = [[NSButtonCell alloc] init];
+ [(NSButtonCell*)o_dataCell setButtonType:NSSwitchButton];
+ [o_dataCell setTitle:@""];
+ [o_dataCell setFont:[NSFont systemFontOfSize:0]];
+ NSTableColumn *o_tableColumn = [[NSTableColumn alloc]
+ initWithIdentifier:@"Enabled"];
+ [o_tableColumn setHeaderCell: o_headerCell];
+ [o_tableColumn setDataCell: o_dataCell];
+ [o_tableColumn setWidth:17];
+ [o_tableview addTableColumn: o_tableColumn];
+
+ o_headerCell = [[NSCell alloc] initTextCell:@"Module Name"];
+ o_dataCell = [[NSTextFieldCell alloc] init];
+ [o_dataCell setFont:[NSFont systemFontOfSize:12]];
+ o_tableColumn = [[NSTableColumn alloc]
+ initWithIdentifier:@"Module"];
+ [o_tableColumn setHeaderCell: o_headerCell];
+ [o_tableColumn setDataCell: o_dataCell];
+ [o_tableColumn setWidth:s_rc.size.width - 34];
+ [o_tableview addTableColumn: o_tableColumn];
+ [o_tableview registerForDraggedTypes:[NSArray arrayWithObjects:
+ @"VLC media player module", nil]];
+
+ [o_tableview setDataSource:self];
+ [o_tableview setTarget: self];
+ [o_tableview setAction: @selector(tableChanged:)];
+ [o_tableview sendActionOn:NSLeftMouseUpMask | NSLeftMouseDownMask |
+ NSLeftMouseDraggedMask];
+ [o_scrollview setDocumentView: o_tableview];
+ }
+ [o_scrollview setAutoresizingMask:NSViewWidthSizable ];
+ [o_scrollview setAutohidesScrollers:YES];
+ [self addSubview: o_scrollview];
}
return self;
return strdup( [[o_textfield stringValue] UTF8String] );
}
+-(void)resetValues
+{
+#warning Reset prefs of the module selector is broken atm.
+ NSLog( @"don't forget about modulelistconfig" );
+ [super resetValues];
+}
+
@end
@implementation ModuleListConfigControl (NSTableDataSource)