Commit d496ba57 authored by David Fuhrmann's avatar David Fuhrmann

macosx: advanced prefs: add support for config sections

close #7971
parent 65103f63
...@@ -385,13 +385,13 @@ static VLCPrefs *_o_sharedMainInstance = nil; ...@@ -385,13 +385,13 @@ static VLCPrefs *_o_sharedMainInstance = nil;
} }
} }
if (module_is_main(p_module) && CONFIG_ITEM(configType)) { if (module_is_main(p_module) && (CONFIG_ITEM(configType) || configType == CONFIG_SECTION)) {
if (categoryItem && [self isSubCategoryGeneral:lastsubcat]) if (categoryItem && [self isSubCategoryGeneral:lastsubcat])
[[categoryItem options] addObject:[[VLCTreeLeafItem alloc] initWithConfigItem:&p_configs[j]]]; [[categoryItem options] addObject:[[VLCTreeLeafItem alloc] initWithConfigItem:&p_configs[j]]];
else if (subCategoryItem) else if (subCategoryItem)
[[subCategoryItem options] addObject:[[VLCTreeLeafItem alloc] initWithConfigItem:&p_configs[j]]]; [[subCategoryItem options] addObject:[[VLCTreeLeafItem alloc] initWithConfigItem:&p_configs[j]]];
} }
else if (!module_is_main(p_module) && CONFIG_ITEM(configType)) { else if (!module_is_main(p_module) && (CONFIG_ITEM(configType) || configType == CONFIG_SECTION)) {
if (![[subCategoryItem children] containsObject: pluginItem]) if (![[subCategoryItem children] containsObject: pluginItem])
[[subCategoryItem children] addObject:pluginItem]; [[subCategoryItem children] addObject:pluginItem];
......
...@@ -208,6 +208,15 @@ static NSMenu *o_keys_menu = nil; ...@@ -208,6 +208,15 @@ static NSMenu *o_keys_menu = nil;
@end @end
@interface SectionControl : VLCConfigControl
{
}
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view;
@end
//#undef CONFIG_ITEM_LIST_STRING //#undef CONFIG_ITEM_LIST_STRING
//#undef CONFIG_ITEM_RANGED_INTEGER //#undef CONFIG_ITEM_RANGED_INTEGER
...@@ -838,6 +838,9 @@ o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain]; \ ...@@ -838,6 +838,9 @@ o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain]; \
case CONFIG_ITEM_MODULE_LIST_CAT: case CONFIG_ITEM_MODULE_LIST_CAT:
p_control = [[ModuleListConfigControl alloc] initWithItem: _p_item withView: o_parent_view]; p_control = [[ModuleListConfigControl alloc] initWithItem: _p_item withView: o_parent_view];
break; break;
case CONFIG_SECTION:
p_control = [[SectionControl alloc] initWithItem: _p_item withView: o_parent_view];
break;
default: default:
break; break;
} }
...@@ -2315,3 +2318,44 @@ o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain]; \ ...@@ -2315,3 +2318,44 @@ o_textfield = [[[NSSecureTextField alloc] initWithFrame: s_rc] retain]; \
withObject: anObject]; withObject: anObject];
} }
@end @end
@implementation SectionControl
- (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 = 17;
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN;
mainFrame.origin.x = LEFTMARGIN;
mainFrame.origin.y = 0;
if ([super initWithFrame: mainFrame item: _p_item] != nil) {
/* add the label */
if (p_item->psz_text)
o_labelString = _NS((char *)p_item->psz_text);
else
o_labelString = @"";
NSDictionary *boldAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
[NSFont boldSystemFontOfSize:[NSFont systemFontSize]],
NSFontAttributeName,
nil];
NSAttributedString *o_bold_string = [[NSAttributedString alloc] initWithString: o_labelString attributes: boldAttributes];
ADD_LABEL(o_label, mainFrame, 1, 0, @"", @"")
[o_label setAttributedStringValue: o_bold_string];
[o_label sizeToFit];
[o_bold_string release];
[o_label setAutoresizingMask:NSViewNotSizable];
[self addSubview: o_label];
}
return self;
}
@end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment