- the documentview with all the prefs widgets in it
- a saveChanges action
- a revertChanges action
- - an advanced action (to hide/show advanced options)
- a redraw view action
- the children action should generate a list of the treeitems children (to be used by VLCPrefs datasource)
- (void)awakeFromNib
{
p_intf = VLCIntf;
- b_advanced = config_GetInt( p_intf, "advanced" );
[self initStrings];
- [o_advanced_ckb setState: b_advanced];
[o_prefs_view setBorderType: NSGrooveBorder];
[o_prefs_view setHasVerticalScroller: YES];
[o_prefs_view setDrawsBackground: NO];
[o_save_btn setTitle: _NS("Save")];
[o_cancel_btn setTitle: _NS("Cancel")];
[o_reset_btn setTitle: _NS("Reset All")];
- [o_advanced_ckb setTitle: _NS("Advanced")];
[[o_basicFull_matrix cellAtRow: 0 column: 0] setStringValue: _NS("Basic")];
[[o_basicFull_matrix cellAtRow: 0 column: 1] setStringValue: _NS("All")];
}
config_ResetAll( p_intf );
[[VLCTreeItem rootItem] resetView];
[[o_tree itemAtRow:[o_tree selectedRow]]
- showView:o_prefs_view advancedView:
- ( [o_advanced_ckb state] == NSOnState ) ? true : false];
+ showView:o_prefs_view];
}
}
-- (IBAction)advancedToggle: (id)sender
-{
- b_advanced = !b_advanced;
- [o_advanced_ckb setState: b_advanced];
- /* refresh the view of the current treeitem */
- [[o_tree itemAtRow:[o_tree selectedRow]] showView:o_prefs_view advancedView:
- ( [o_advanced_ckb state] == NSOnState ) ? true : false];
-}
-
- (IBAction)buttonAction: (id)sender
{
[o_prefs_window orderOut: self];
/* update the document view to the view of the selected tree item */
- (void)outlineViewSelectionDidChange:(NSNotification *)o_notification
{
- [[o_tree itemAtRow:[o_tree selectedRow]] showView: o_prefs_view
- advancedView:( [o_advanced_ckb state] == NSOnState ) ?
- true : false];
+ [[o_tree itemAtRow:[o_tree selectedRow]] showView: o_prefs_view];
}
@end
initWithName: o_child_name
withTitle: o_child_title
withHelp: o_child_help
- ID: p_items[i].value.i
+ ID: ((vlc_object_t*)p_main_module)->i_object_id
parent:self
children:[[NSMutableArray alloc]
initWithCapacity:10]
- whithCategory: p_items[i].i_type]];
+ whithCategory: p_items[i].value.i]];
break;
case CONFIG_SUBCATEGORY:
if( p_items[i].value.i == -1 ) break;
initWithName: o_child_name
withTitle: o_child_title
withHelp: o_child_help
- ID: p_items[i].value.i
+ ID: ((vlc_object_t*)p_main_module)->i_object_id
parent:p_last_category
children:[[NSMutableArray alloc]
initWithCapacity:10]
- whithCategory: p_items[i].i_type]];
+ whithCategory: p_items[i].value.i]];
}
break;
/* Exclude empty plugins (submodules don't have config */
/* options, they are stored in the parent module) */
-// Does not work
-// if( modules_IsSubModule( p_module ) )
-// continue;
p_items = module_GetConfig( p_module, &confsize );
unsigned int j;
long cookie;
bool b_found = false;
- unsigned int i;
+
VLCTreeItem* p_category_item, * p_subcategory_item;
- for (i = 0 ; i < [o_children count] ; i++)
+ for (j = 0 ; j < [o_children count] ; j++)
{
- p_category_item = [o_children objectAtIndex: i];
- if( p_category_item->i_object_id == i_category )
+ p_category_item = [o_children objectAtIndex: j];
+ if( p_category_item->i_object_category == i_category )
{
b_found = true;
break;
/* Find subcategory item */
b_found = false;
cookie = -1;
- for (i = 0 ; i < [p_category_item->o_children count] ; i++)
+ for (j = 0 ; j < [p_category_item->o_children count] ; j++)
{
p_subcategory_item = [p_category_item->o_children
- objectAtIndex: i];
- if( p_subcategory_item->i_object_id == i_subcategory )
+ objectAtIndex: j];
+ if( p_subcategory_item->i_object_category == i_subcategory )
{
b_found = true;
break;
children:IsALeafNode
whithCategory: -1]];
}
+ vlc_list_release( p_list );
}
- vlc_list_release( p_list );
}
return o_children;
}
}
- (NSView *)showView:(NSScrollView *)o_prefs_view
- advancedView:(bool) b_advanced
{
NSRect s_vrc;
NSView *o_view;
unsigned int i, confsize;
p_items = module_GetConfig( p_main_module, &confsize );
+ /* We need to first, find the right (sub)category,
+ * and then abort when we find a new (sub)category. Part of the Ugliness. */
+ bool in_right_category = false;
+ bool in_subcategory = false;
+ bool done = false;
for( i = 0; i < confsize; i++ )
{
if( !p_items[i].i_type )
switch( p_items[i].i_type )
{
- case CONFIG_SUBCATEGORY:
case CONFIG_CATEGORY:
+ if(!in_right_category && p_items[i].value.i == i_object_category)
+ in_right_category = true;
+ else if(in_right_category)
+ done = true;
+ break;
+ case CONFIG_SUBCATEGORY:
+ if(!in_right_category && p_items[i].value.i == i_object_category)
+ {
+ in_right_category = true;
+ in_subcategory = true;
+ }
+ else if(in_right_category && in_subcategory)
+ done = true;
+ break;
case CONFIG_SECTION:
case CONFIG_HINT_USAGE:
break;
default:
{
+ if(!in_right_category) break;
+
VLCConfigControl *o_control = nil;
o_control = [VLCConfigControl newControl:&p_items[i]
withView:o_view];
break;
}
}
+ if( done ) break;
}
vlc_object_release( (vlc_object_t*)p_main_module );
}
int i_lastItem = 0;
int i_yPos = -2;
int i_max_label = 0;
- int i_show_advanced = 0;
NSEnumerator *enumerator = [o_subviews objectEnumerator];
VLCConfigControl *o_widget;
NSRect o_frame;
while( ( o_widget = [enumerator nextObject] ) )
- if( ( [o_widget isAdvanced] ) && (! b_advanced) )
- continue;
- else if( i_max_label < [o_widget getLabelSize] )
+ if( i_max_label < [o_widget getLabelSize] )
i_max_label = [o_widget getLabelSize];
enumerator = [o_subviews objectEnumerator];
while( ( o_widget = [enumerator nextObject] ) )
{
int i_widget;
- if( ( [o_widget isAdvanced] ) && (! b_advanced) )
- {
- i_show_advanced++;
- continue;
- }
i_widget = [o_widget getViewType];
i_yPos += [VLCConfigControl calcVerticalMargin:i_widget
i_lastItem = i_widget;
[o_view addSubview:o_widget];
}
- if( i_show_advanced != 0 )
- {
- /* We add the advanced notice... */
- NSRect s_rc = [o_view frame];
- NSTextField *o_label;
- s_rc.size.height = 17;
- s_rc.origin.x = LEFTMARGIN;
- s_rc.origin.y = i_yPos += [VLCConfigControl
- calcVerticalMargin:CONFIG_ITEM_STRING
- lastItem:i_lastItem];
- o_label = [[[NSTextField alloc] initWithFrame: s_rc] retain];
- [o_label setDrawsBackground: NO];
- [o_label setBordered: NO];
- [o_label setEditable: NO];
- [o_label setSelectable: NO];
- [o_label setStringValue: _NS("Some options are hidden. " \
- "Check \"Advanced\" to display them.")];
- [o_label setFont:[NSFont systemFontOfSize:10]];
- [o_label sizeToFit];
- [o_view addSubview:o_label];
- i_yPos += [o_label frame].size.height;
- }
+
o_frame = [o_view frame];
o_frame.size.height = i_yPos;
[o_view setFrame:o_frame];