o_parent = o_parent_item;
o_children = o_children_array;
i_object_category = i_category;
- o_view = nil;
+ o_subviews = nil;
}
return( self );
}
advancedView:(vlc_bool_t) b_advanced
{
fprintf( stderr, "[%s] showView\n", [o_name UTF8String] );
- if( o_view == nil )
+ NSRect s_vrc;
+ NSView *o_view;
+
+ s_vrc = [[o_prefs_view contentView] bounds]; s_vrc.size.height -= 4;
+ o_view = [[VLCFlippedView alloc] initWithFrame: s_vrc];
+ [o_view setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
+
+/* Create all subviews if it isn't already done because we cannot use setHiden for MacOS < 10.3*/
+ if( o_subviews == nil )
{
intf_thread_t *p_intf = VLCIntf;
vlc_list_t *p_list;
module_t *p_parser = NULL;
module_config_t *p_item;
- NSRect s_vrc;
-
- s_vrc = [[o_prefs_view contentView] bounds]; s_vrc.size.height -= 4;
- o_view = [[VLCFlippedView alloc] initWithFrame: s_vrc];
- [o_view setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
+ o_subviews = [[NSMutableArray alloc] initWithCapacity:10];
/* Get a pointer to the module */
if( i_object_category == -1 )
{
{
VLCConfigControl *o_control = nil;
int i_widget = 0;
- if( p_item->b_advanced && (! b_advanced) )
- break;
switch( p_item->i_type )
{
case CONFIG_ITEM_STRING:
calcVerticalMargin:i_widget lastItem:i_lastItem];
o_control = [VLCConfigControl newControl:p_item
withView:o_view
- yOffset: i_yPos
- lastItem: i_lastItem];
+ yOffset: i_yPos];
if( o_control != nil )
{
i_yPos += [o_control frame].size.height;
i_lastItem = i_widget;
[o_control setAutoresizingMask: NSViewMaxYMargin |
NSViewWidthSizable];
- [o_view addSubview: o_control];
+ [o_subviews addObject: o_control];
}
}
fprintf( stderr, "\n" );
calcVerticalMargin:i_widget lastItem:i_lastItem];
o_control = [VLCConfigControl newControl:p_item
withView:o_view
- yOffset: i_yPos
- lastItem: i_lastItem];
+ yOffset: i_yPos];
if( o_control != nil )
{
i_yPos += [o_control frame].size.height;
i_lastItem = i_widget;
[o_control setAutoresizingMask: NSViewMaxYMargin |
NSViewWidthSizable];
- [o_view addSubview: o_control];
+ [o_subviews addObject: o_control];
}
}
fprintf( stderr, "\n" );
vlc_list_release( p_list );
}
}
- else
- {
- NSRect s_vrc;
- s_vrc = [[o_prefs_view contentView] bounds]; s_vrc.size.height -= 4;
- [o_view setFrame: s_vrc];
- }
+
if( o_view != nil )
+ {
+ int i_lastItem = 0;
+ int i_yPos = 0;
+ unsigned int i;
+ for( i = 0 ; i < [o_subviews count] ; i++ )
+ {
+ int i_widget;
+ VLCConfigControl *o_widget = [o_subviews objectAtIndex:i];
+ if( ( [o_widget isAdvanced] ) && (! b_advanced) )
+ continue;
+
+ i_widget = [o_widget getViewType];
+ i_yPos += [VLCConfigControl calcVerticalMargin:i_widget
+ lastItem:i_lastItem];
+ [o_widget setYPos:i_yPos];
+ i_yPos += [o_widget frame].size.height;
+ i_lastItem = i_widget;
+ [o_widget setAutoresizingMask: NSViewMaxYMargin |
+ NSViewWidthSizable];
+ [o_view addSubview:o_widget];
+ }
+
[o_prefs_view setDocumentView:o_view];
+ }
return o_view;
}
- (void)applyChanges
{
unsigned int i;
- if( o_view != nil )
+ if( o_subviews != nil )
{
//Item has been shown
fprintf( stderr, "[%s] applying changes\n", [o_name cString]);
- NSArray *o_subviews = [o_view subviews];
for( i = 0 ; i < [o_subviews count] ; i++ )
[[o_subviews objectAtIndex:i] applyChanges];
}
char *psz_name;
NSTextField *o_label;
int i_type;
+ int i_view_type;
vlc_bool_t b_advanced;
}
-+ (VLCConfigControl *)newControl: (module_config_t *)_p_item withView: (NSView *)o_parent_view yOffset:(int) i_yPos lastItem: (int) i_lastItem;
++ (VLCConfigControl *)newControl: (module_config_t *)_p_item
+ withView: (NSView *)o_parent_view yOffset:(int) i_yPos;
- (id)initWithFrame: (NSRect)frame item: (module_config_t *)p_item;
- (NSString *)getName;
- (int)getType;
+- (int)getViewType;
- (BOOL)isAdvanced;
-
+- (void)setYPos:(int)i_yPos;
- (int)intValue;
- (float)floatValue;
- (char *)stringValue;
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
- withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem;
+ withVerticalOffset: (int)i_yPos;
@end
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
- withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem;
+ withVerticalOffset: (int)i_yPos;
@end
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
- withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem;
+ withVerticalOffset: (int)i_yPos;
- (IBAction)openFileDialog: (id)sender;
- (void)pathChosenInPanel:(NSOpenPanel *)o_sheet withReturn:(int)i_return_code contextInfo:(void *)o_context_info;
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
- withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem;
+ withVerticalOffset: (int)i_yPos;
@end
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
- withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem;
+ withVerticalOffset: (int)i_yPos;
- (IBAction)stepperChanged:(id)sender;
- (void)textfieldChanged:(NSNotification *)o_notification;
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
- withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem;
+ withVerticalOffset: (int)i_yPos;
@end
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
- withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem;
+ withVerticalOffset: (int)i_yPos;
- (IBAction)sliderChanged:(id)sender;
- (void)textfieldChanged:(NSNotification *)o_notification;
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
- withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem;
+ withVerticalOffset: (int)i_yPos;
@end
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
- withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem;
+ withVerticalOffset: (int)i_yPos;
- (IBAction)stepperChanged:(id)sender;
- (void)textfieldChanged:(NSNotification *)o_notification;
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
- withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem;
+ withVerticalOffset: (int)i_yPos;
- (IBAction)sliderChanged:(id)sender;
- (void)textfieldChanged:(NSNotification *)o_notification;
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
- withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem;
+ withVerticalOffset: (int)i_yPos;
@end
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
- withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem;
+ withVerticalOffset: (int)i_yPos;
@end
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
- withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem;
+ withVerticalOffset: (int)i_yPos;
@end
psz_name = strdup( p_item->psz_name );
o_label = NULL;
i_type = p_item->i_type;
+ i_view_type = 0;
b_advanced = p_item->b_advanced;
[self setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin ];
}
return (self);
}
+- (void)setYPos:(int)i_yPos
+{
+ NSRect frame = [self frame];
+ frame.origin.y = i_yPos;
+ [self setFrame:frame];
+}
+
- (void)dealloc
{
if( o_label ) [o_label release];
+ (VLCConfigControl *)newControl: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
yOffset:(int) i_yPos
- lastItem: (int) i_lastItem
{
VLCConfigControl *p_control = NULL;
switch( _p_item->i_type )
p_control = [[StringConfigControl alloc]
initWithItem: _p_item
withView: o_parent_view
- withVerticalOffset: i_yPos
- withLastItem: i_lastItem];
+ withVerticalOffset: i_yPos];
}
else
{
p_control = [[StringListConfigControl alloc]
initWithItem: _p_item
withView: o_parent_view
- withVerticalOffset: i_yPos
- withLastItem: i_lastItem];
+ withVerticalOffset: i_yPos];
}
break;
case CONFIG_ITEM_FILE:
p_control = [[FileConfigControl alloc]
initWithItem: _p_item
withView: o_parent_view
- withVerticalOffset: i_yPos
- withLastItem: i_lastItem];
+ withVerticalOffset: i_yPos];
break;
case CONFIG_ITEM_MODULE:
case CONFIG_ITEM_MODULE_CAT:
p_control = [[ModuleConfigControl alloc]
initWithItem: _p_item
withView: o_parent_view
- withVerticalOffset: i_yPos
- withLastItem: i_lastItem];
+ withVerticalOffset: i_yPos];
break;
case CONFIG_ITEM_INTEGER:
if( _p_item->i_list )
p_control = [[IntegerListConfigControl alloc]
initWithItem: _p_item
withView: o_parent_view
- withVerticalOffset: i_yPos
- withLastItem: i_lastItem];
+ withVerticalOffset: i_yPos];
}
else if( _p_item->i_min != 0 || _p_item->i_max != 0 )
{
p_control = [[RangedIntegerConfigControl alloc]
initWithItem: _p_item
withView: o_parent_view
- withVerticalOffset: i_yPos
- withLastItem: i_lastItem];
+ withVerticalOffset: i_yPos];
}
else
{
p_control = [[IntegerConfigControl alloc]
initWithItem: _p_item
withView: o_parent_view
- withVerticalOffset: i_yPos
- withLastItem: i_lastItem];
+ withVerticalOffset: i_yPos];
}
break;
case CONFIG_ITEM_BOOL:
p_control = [[BoolConfigControl alloc]
initWithItem: _p_item
withView: o_parent_view
- withVerticalOffset: i_yPos
- withLastItem: i_lastItem];
+ withVerticalOffset: i_yPos];
break;
case CONFIG_ITEM_FLOAT:
if( _p_item->f_min != 0 || _p_item->f_max != 0 )
p_control = [[RangedFloatConfigControl alloc]
initWithItem: _p_item
withView: o_parent_view
- withVerticalOffset: i_yPos
- withLastItem: i_lastItem];
+ withVerticalOffset: i_yPos];
}
else
{
p_control = [[FloatConfigControl alloc]
initWithItem: _p_item
withView: o_parent_view
- withVerticalOffset: i_yPos
- withLastItem: i_lastItem];
+ withVerticalOffset: i_yPos];
}
break;
case CONFIG_ITEM_KEY:
p_control = [[KeyConfigControlBefore103 alloc]
initWithItem: _p_item
withView: o_parent_view
- withVerticalOffset: i_yPos
- withLastItem: i_lastItem];
+ withVerticalOffset: i_yPos];
}
else
{
p_control = [[KeyConfigControlAfter103 alloc]
initWithItem: _p_item
withView: o_parent_view
- withVerticalOffset: i_yPos
- withLastItem: i_lastItem];
+ withVerticalOffset: i_yPos];
}
break;
case CONFIG_ITEM_MODULE_LIST:
p_control = [[ModuleListConfigControl alloc]
initWithItem: _p_item
withView: o_parent_view
- withVerticalOffset: i_yPos
- withLastItem: i_lastItem];
+ withVerticalOffset: i_yPos];
break;
default:
break;
return i_type;
}
+- (int)getViewType
+{
+ return i_view_type;
+}
+
- (BOOL)isAdvanced
{
return b_advanced;
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem
{
NSRect mainFrame = [o_parent_view frame];
NSString *o_labelString, *o_textfieldString, *o_textfieldTooltip;
if( [super initWithFrame: mainFrame item: _p_item] != nil )
{
+ i_view_type = CONFIG_ITEM_STRING;
/* add the label */
if( p_item->psz_text )
o_labelString = [[VLCMain sharedInstance]
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem
{
NSRect mainFrame = [o_parent_view frame];
NSString *o_labelString, *o_textfieldTooltip;
if( [super initWithFrame: mainFrame item: _p_item] != nil )
{
int i_index;
+ i_view_type = CONFIG_ITEM_STRING_LIST;
/* add the label */
if( p_item->psz_text )
o_labelString = [[VLCMain sharedInstance]
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem
{
NSRect mainFrame = [o_parent_view frame];
NSString *o_labelString, *o_buttonTooltip, *o_textfieldString;
if( [super initWithFrame: mainFrame item: _p_item] != nil )
{
+ i_view_type = CONFIG_ITEM_FILE;
+
/* is it a directory */
b_directory = ( [self getType] == CONFIG_ITEM_DIRECTORY ) ? YES : NO;
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem
{
NSRect mainFrame = [o_parent_view frame];
NSString *o_labelString, *o_popupTooltip;
int i_index;
vlc_list_t *p_list;
module_t *p_parser;
+ i_view_type = CONFIG_ITEM_MODULE;
+
/* add the label */
if( p_item->psz_text )
o_labelString = [[VLCMain sharedInstance]
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem
{
NSRect mainFrame = [o_parent_view frame];
NSString *o_labelString, *o_tooltip, *o_textfieldString;
if( [super initWithFrame: mainFrame item: _p_item] != nil )
{
+ i_view_type = CONFIG_ITEM_INTEGER;
+
o_tooltip = [[VLCMain sharedInstance] wrapString:
[[VLCMain sharedInstance]
localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP];
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem
{
NSRect mainFrame = [o_parent_view frame];
NSString *o_labelString, *o_textfieldTooltip;
if( [super initWithFrame: mainFrame item: _p_item] != nil )
{
int i_index;
+ i_view_type = CONFIG_ITEM_STRING_LIST;
+
/* add the label */
if( p_item->psz_text )
o_labelString = [[VLCMain sharedInstance]
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem
{
NSRect mainFrame = [o_parent_view frame];
NSString *o_labelString, *o_tooltip;
if( [super initWithFrame: mainFrame item: _p_item] != nil )
{
+ i_view_type = CONFIG_ITEM_RANGED_INTEGER;
+
/* add the label */
if( p_item->psz_text )
o_labelString = [[VLCMain sharedInstance]
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem
{
NSRect mainFrame = [o_parent_view frame];
NSString *o_labelString, *o_tooltip, *o_textfieldString;
if( [super initWithFrame: mainFrame item: _p_item] != nil )
{
+ i_view_type = CONFIG_ITEM_INTEGER;
+
o_tooltip = [[VLCMain sharedInstance] wrapString:
[[VLCMain sharedInstance]
localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP];
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem
{
NSRect mainFrame = [o_parent_view frame];
NSString *o_labelString, *o_tooltip;
if( [super initWithFrame: mainFrame item: _p_item] != nil )
{
+ i_view_type = CONFIG_ITEM_RANGED_INTEGER;
+
/* add the label */
if( p_item->psz_text )
o_labelString = [[VLCMain sharedInstance]
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem
{
NSRect mainFrame = [o_parent_view frame];
NSString *o_labelString, *o_tooltip;
if( [super initWithFrame: mainFrame item: _p_item] != nil )
{
+ i_view_type = CONFIG_ITEM_BOOL;
+
/* add the checkbox */
if( p_item->psz_text )
o_labelString = [[VLCMain sharedInstance]
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem
{
NSRect mainFrame = [o_parent_view frame];
NSString *o_labelString, *o_tooltip;
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]
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem
{
NSRect mainFrame = [o_parent_view frame];
NSString *o_labelString, *o_tooltip;
if( [super initWithFrame: mainFrame item: _p_item] != nil )
{
+ i_view_type = CONFIG_ITEM_KEY_AFTER_10_3;
+
/* add the label */
if( p_item->psz_text )
o_labelString = [[VLCMain sharedInstance]
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view
withVerticalOffset: (int)i_yPos
- withLastItem: (int)i_lastItem
{
if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST )
//TODO....
mainFrame.origin.y = i_yPos;
if( [super initWithFrame: mainFrame item: _p_item] != nil )
{
+ i_view_type = CONFIG_ITEM_MODULE_LIST;
+
/* add the label */
if( p_item->psz_text )
o_labelString = [[VLCMain sharedInstance]