|
|
|
@ -1,7 +1,7 @@ |
|
|
|
/***************************************************************************** |
|
|
|
* 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> |
|
|
|
@ -2146,15 +2146,15 @@ o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain]; \ |
|
|
|
withView: (NSView *)o_parent_view |
|
|
|
{ |
|
|
|
if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST ) |
|
|
|
//TODO.... |
|
|
|
//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 ); |
|
|
|
@ -2162,132 +2162,132 @@ o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain]; \ |
|
|
|
{ |
|
|
|
int i; |
|
|
|
p_parser = p_list[i_module_index]; |
|
|
|
|
|
|
|
|
|
|
|
if( module_is_main( p_parser ) ) |
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
unsigned int 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 = &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_get_name( p_parser, TRUE )]; |
|
|
|
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; |
|
|
|
|