1
mirror of https://code.videolan.org/videolan/vlc synced 2024-08-06 16:44:19 +02:00

* Section titles for the OSX Preferences.

This commit is contained in:
Derk-Jan Hartman 2005-08-19 16:16:34 +00:00
parent 1dffce3b38
commit 7db33a0adc
7 changed files with 73 additions and 34 deletions

View File

@ -437,6 +437,7 @@
"o_prefs_window" = id;
"o_reset_btn" = id;
"o_save_btn" = id;
"o_title" = id;
"o_tree" = id;
};
SUPERCLASS = NSObject;

View File

@ -3,9 +3,9 @@
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>30 60 505 518 0 0 800 578 </string>
<string>169 56 505 518 0 0 1280 1002 </string>
<key>IBFramework Version</key>
<string>364.0</string>
<string>439.0</string>
<key>IBLockedObjects</key>
<array>
<integer>2203</integer>
@ -13,7 +13,11 @@
<integer>2206</integer>
<integer>2199</integer>
</array>
<key>IBOpenObjects</key>
<array>
<integer>1530</integer>
</array>
<key>IBSystem Version</key>
<string>7W98</string>
<string>8C46</string>
</dict>
</plist>

View File

@ -24,6 +24,8 @@
@interface VLCTreeItem : NSObject
{
NSString *o_name;
NSString *o_title;
NSString *o_help;
int i_object_id;
VLCTreeItem *o_parent;
NSMutableArray *o_children;
@ -36,6 +38,8 @@
- (VLCTreeItem *)childAtIndex:(int)i_index;
- (int)getObjectID;
- (NSString *)getName;
- (NSString *)getTitle;
- (NSString *)getHelp;
- (BOOL)hasPrefs:(NSString *)o_module_name;
- (NSView *)showView:(NSScrollView *)o_prefs_view advancedView:(vlc_bool_t) b_advanced;
- (void)applyChanges;
@ -67,6 +71,7 @@
+ (VLCPrefs *)sharedInstance;
- (void)initStrings;
- (void)setTitle: (NSString *) o_title_name;
- (void)showPrefs;
- (IBAction)savePrefs: (id)sender;
- (IBAction)closePrefs: (id)sender;

View File

@ -101,6 +101,11 @@ static VLCPrefs *_o_sharedMainInstance = nil;
[o_tree selectRow:0 byExtendingSelection:NO];
}
- (void)setTitle: (NSString *) o_title_name
{
[o_title setStringValue: o_title_name];
}
- (void)showPrefs
{
/* load our nib (if not already loaded) */
@ -214,7 +219,10 @@ static VLCTreeItem *o_root_item = nil;
#define IsALeafNode ((id)-1)
- (id)initWithName: (NSString *)o_item_name ID: (int)i_id
- (id)initWithName: (NSString *)o_item_name
withTitle: (NSString *)o_item_title
withHelp: (NSString *)o_item_help
ID: (int)i_id
parent:(VLCTreeItem *)o_parent_item
children:(NSMutableArray *)o_children_array
whithCategory: (int) i_category
@ -224,6 +232,8 @@ static VLCTreeItem *o_root_item = nil;
if( self != nil )
{
o_name = [o_item_name copy];
o_title= [o_item_title copy];
o_help= [o_item_help copy];
i_object_id = i_id;
o_parent = o_parent_item;
o_children = o_children_array;
@ -236,7 +246,7 @@ static VLCTreeItem *o_root_item = nil;
+ (VLCTreeItem *)rootItem
{
if (o_root_item == nil)
o_root_item = [[VLCTreeItem alloc] initWithName:@"main" ID:0
o_root_item = [[VLCTreeItem alloc] initWithName:@"main" withTitle:@"main" withHelp:@"" ID:0
parent:nil children:[[NSMutableArray alloc] initWithCapacity:10]
whithCategory: -1];
return o_root_item;
@ -246,6 +256,8 @@ static VLCTreeItem *o_root_item = nil;
{
if (o_children != IsALeafNode) [o_children release];
[o_name release];
[o_title release];
[o_help release];
[super dealloc];
}
@ -295,14 +307,21 @@ static VLCTreeItem *o_root_item = nil;
if( p_item ) do
{
NSString *o_child_name;
NSString *o_child_title;
NSString *o_child_help;
switch( p_item->i_type )
{
case CONFIG_CATEGORY:
o_child_name = [[VLCMain sharedInstance]
localizedString: config_CategoryNameGet(p_item->i_value ) ];
localizedString: config_CategoryNameGet( p_item->i_value ) ];
o_child_title = o_child_name;
o_child_help = [[VLCMain sharedInstance]
localizedString: config_CategoryHelpGet( p_item->i_value ) ];
p_last_category = [VLCTreeItem alloc];
[o_children addObject:[p_last_category
initWithName: o_child_name
withTitle: o_child_title
withHelp: o_child_help
ID: p_item->i_value
parent:self
children:[[NSMutableArray alloc]
@ -311,13 +330,18 @@ static VLCTreeItem *o_root_item = nil;
break;
case CONFIG_SUBCATEGORY:
o_child_name = [[VLCMain sharedInstance]
localizedString: config_CategoryNameGet(p_item->i_value ) ];
localizedString: config_CategoryNameGet( p_item->i_value ) ];
o_child_title = o_child_name;
o_child_help = [[VLCMain sharedInstance]
localizedString: config_CategoryHelpGet( p_item->i_value ) ];
if( p_item->i_value != SUBCAT_PLAYLIST_GENERAL &&
p_item->i_value != SUBCAT_VIDEO_GENERAL &&
p_item->i_value != SUBCAT_AUDIO_GENERAL )
[p_last_category->o_children
addObject:[[VLCTreeItem alloc]
initWithName: o_child_name
withTitle: o_child_title
withHelp: o_child_help
ID: p_item->i_value
parent:p_last_category
children:[[NSMutableArray alloc]
@ -402,6 +426,10 @@ static VLCTreeItem *o_root_item = nil;
initWithName:[[VLCMain sharedInstance]
localizedString: p_module->psz_shortname ?
p_module->psz_shortname : p_module->psz_object_name ]
withTitle:[[VLCMain sharedInstance]
localizedString: p_module->psz_longname ?
p_module->psz_longname : p_module->psz_object_name ]
withHelp: @""
ID: p_module->i_object_id
parent:p_subcategory_item
children:IsALeafNode
@ -423,6 +451,16 @@ static VLCTreeItem *o_root_item = nil;
return o_name;
}
- (NSString *)getTitle
{
return o_title;
}
- (NSString *)getHelp
{
return o_help;
}
- (VLCTreeItem *)childAtIndex:(int)i_index
{
return [[self children] objectAtIndex:i_index];
@ -469,6 +507,8 @@ static VLCTreeItem *o_root_item = nil;
NSRect s_vrc;
NSView *o_view;
[[VLCPrefs sharedInstance] setTitle: [self getTitle]];
/* NSLog( [self getHelp] ); */
s_vrc = [[o_prefs_view contentView] bounds]; s_vrc.size.height -= 4;
o_view = [[VLCFlippedView alloc] initWithFrame: s_vrc];
[o_view setAutoresizingMask: NSViewWidthSizable | NSViewMinYMargin |
@ -509,16 +549,17 @@ static VLCTreeItem *o_root_item = nil;
{
case CONFIG_SUBCATEGORY:
break;
case CONFIG_SECTION:
break;
case CONFIG_CATEGORY:
break;
case CONFIG_SECTION:
break;
case CONFIG_HINT_END:
break;
case CONFIG_HINT_USAGE:
break;
default:
{
NSLog( @"one" );
VLCConfigControl *o_control = nil;
o_control = [VLCConfigControl newControl:p_item
withView:o_view];
@ -572,14 +613,14 @@ static VLCTreeItem *o_root_item = nil;
msg_Err( p_intf, "null item found" );
break;
}
switch(p_item->i_type)
switch( p_item->i_type )
{
case CONFIG_SUBCATEGORY:
break;
case CONFIG_SECTION:
break;
case CONFIG_CATEGORY:
break;
case CONFIG_SECTION:
break;
case CONFIG_HINT_END:
break;
case CONFIG_HINT_USAGE:

View File

@ -216,7 +216,7 @@ static NSMenu *o_keys_menu = nil;
- (id) initWithItem: (module_config_t *)_p_item
withView: (NSView *)o_parent_view;
@end
//#undef CONFIG_ITEM_LIST_STRING

View File

@ -1936,39 +1936,27 @@ if( MACOS_VERSION >= 10.3 ) \
{
i_view_type = CONFIG_ITEM_BOOL;
/* add the checkbox */
o_tooltip = [[VLCMain sharedInstance]
wrapString: [[VLCMain sharedInstance]
localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP];
ADD_CHECKBOX( o_checkbox, mainFrame, 0,
0, @"", o_tooltip, p_item->i_value, NSImageLeft)
[o_checkbox setAutoresizingMask:NSViewNotSizable ];
[self addSubview: o_checkbox];
/* add the label */
if( p_item->psz_text )
o_labelString = [[VLCMain sharedInstance]
localizedString: p_item->psz_text];
else
o_labelString = [NSString stringWithString:@""];
ADD_LABEL( o_label, mainFrame, 0, 0, o_labelString )
ADD_LABEL( o_label, mainFrame, [o_checkbox frame].size.width, 0, o_labelString )
[o_label setAutoresizingMask:NSViewNotSizable ];
[self addSubview: o_label];
/* add the checkbox */
o_tooltip = [[VLCMain sharedInstance]
wrapString: [[VLCMain sharedInstance]
localizedString: p_item->psz_longtext ] toWidth: PREFS_WRAP];
ADD_CHECKBOX( o_checkbox, mainFrame, [o_label frame].size.width,
0, @"", o_tooltip, p_item->i_value, NSImageLeft)
[o_checkbox setAutoresizingMask:NSViewNotSizable ];
[self addSubview: o_checkbox];
}
return self;
}
- (void) alignWithXPosition:(int)i_xPos
{
NSRect frame;
frame = [o_label frame];
frame.origin.x = i_xPos - frame.size.width - 3;
[o_label setFrame:frame];
frame = [o_checkbox frame];
frame.origin.x = i_xPos;
[o_checkbox setFrame:frame];
}
- (void)dealloc
{
[o_checkbox release];