Commit 7db33a0a authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* Section titles for the OSX Preferences.

parent 1dffce3b
...@@ -437,6 +437,7 @@ ...@@ -437,6 +437,7 @@
"o_prefs_window" = id; "o_prefs_window" = id;
"o_reset_btn" = id; "o_reset_btn" = id;
"o_save_btn" = id; "o_save_btn" = id;
"o_title" = id;
"o_tree" = id; "o_tree" = id;
}; };
SUPERCLASS = NSObject; SUPERCLASS = NSObject;
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>IBDocumentLocation</key> <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> <key>IBFramework Version</key>
<string>364.0</string> <string>439.0</string>
<key>IBLockedObjects</key> <key>IBLockedObjects</key>
<array> <array>
<integer>2203</integer> <integer>2203</integer>
...@@ -13,7 +13,11 @@ ...@@ -13,7 +13,11 @@
<integer>2206</integer> <integer>2206</integer>
<integer>2199</integer> <integer>2199</integer>
</array> </array>
<key>IBOpenObjects</key>
<array>
<integer>1530</integer>
</array>
<key>IBSystem Version</key> <key>IBSystem Version</key>
<string>7W98</string> <string>8C46</string>
</dict> </dict>
</plist> </plist>
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
@interface VLCTreeItem : NSObject @interface VLCTreeItem : NSObject
{ {
NSString *o_name; NSString *o_name;
NSString *o_title;
NSString *o_help;
int i_object_id; int i_object_id;
VLCTreeItem *o_parent; VLCTreeItem *o_parent;
NSMutableArray *o_children; NSMutableArray *o_children;
...@@ -36,6 +38,8 @@ ...@@ -36,6 +38,8 @@
- (VLCTreeItem *)childAtIndex:(int)i_index; - (VLCTreeItem *)childAtIndex:(int)i_index;
- (int)getObjectID; - (int)getObjectID;
- (NSString *)getName; - (NSString *)getName;
- (NSString *)getTitle;
- (NSString *)getHelp;
- (BOOL)hasPrefs:(NSString *)o_module_name; - (BOOL)hasPrefs:(NSString *)o_module_name;
- (NSView *)showView:(NSScrollView *)o_prefs_view advancedView:(vlc_bool_t) b_advanced; - (NSView *)showView:(NSScrollView *)o_prefs_view advancedView:(vlc_bool_t) b_advanced;
- (void)applyChanges; - (void)applyChanges;
...@@ -67,6 +71,7 @@ ...@@ -67,6 +71,7 @@
+ (VLCPrefs *)sharedInstance; + (VLCPrefs *)sharedInstance;
- (void)initStrings; - (void)initStrings;
- (void)setTitle: (NSString *) o_title_name;
- (void)showPrefs; - (void)showPrefs;
- (IBAction)savePrefs: (id)sender; - (IBAction)savePrefs: (id)sender;
- (IBAction)closePrefs: (id)sender; - (IBAction)closePrefs: (id)sender;
......
...@@ -101,6 +101,11 @@ static VLCPrefs *_o_sharedMainInstance = nil; ...@@ -101,6 +101,11 @@ static VLCPrefs *_o_sharedMainInstance = nil;
[o_tree selectRow:0 byExtendingSelection:NO]; [o_tree selectRow:0 byExtendingSelection:NO];
} }
- (void)setTitle: (NSString *) o_title_name
{
[o_title setStringValue: o_title_name];
}
- (void)showPrefs - (void)showPrefs
{ {
/* load our nib (if not already loaded) */ /* load our nib (if not already loaded) */
...@@ -214,7 +219,10 @@ static VLCTreeItem *o_root_item = nil; ...@@ -214,7 +219,10 @@ static VLCTreeItem *o_root_item = nil;
#define IsALeafNode ((id)-1) #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 parent:(VLCTreeItem *)o_parent_item
children:(NSMutableArray *)o_children_array children:(NSMutableArray *)o_children_array
whithCategory: (int) i_category whithCategory: (int) i_category
...@@ -224,6 +232,8 @@ static VLCTreeItem *o_root_item = nil; ...@@ -224,6 +232,8 @@ static VLCTreeItem *o_root_item = nil;
if( self != nil ) if( self != nil )
{ {
o_name = [o_item_name copy]; o_name = [o_item_name copy];
o_title= [o_item_title copy];
o_help= [o_item_help copy];
i_object_id = i_id; i_object_id = i_id;
o_parent = o_parent_item; o_parent = o_parent_item;
o_children = o_children_array; o_children = o_children_array;
...@@ -236,7 +246,7 @@ static VLCTreeItem *o_root_item = nil; ...@@ -236,7 +246,7 @@ static VLCTreeItem *o_root_item = nil;
+ (VLCTreeItem *)rootItem + (VLCTreeItem *)rootItem
{ {
if (o_root_item == nil) 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] parent:nil children:[[NSMutableArray alloc] initWithCapacity:10]
whithCategory: -1]; whithCategory: -1];
return o_root_item; return o_root_item;
...@@ -246,6 +256,8 @@ static VLCTreeItem *o_root_item = nil; ...@@ -246,6 +256,8 @@ static VLCTreeItem *o_root_item = nil;
{ {
if (o_children != IsALeafNode) [o_children release]; if (o_children != IsALeafNode) [o_children release];
[o_name release]; [o_name release];
[o_title release];
[o_help release];
[super dealloc]; [super dealloc];
} }
...@@ -295,14 +307,21 @@ static VLCTreeItem *o_root_item = nil; ...@@ -295,14 +307,21 @@ static VLCTreeItem *o_root_item = nil;
if( p_item ) do if( p_item ) do
{ {
NSString *o_child_name; NSString *o_child_name;
NSString *o_child_title;
NSString *o_child_help;
switch( p_item->i_type ) switch( p_item->i_type )
{ {
case CONFIG_CATEGORY: case CONFIG_CATEGORY:
o_child_name = [[VLCMain sharedInstance] 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]; p_last_category = [VLCTreeItem alloc];
[o_children addObject:[p_last_category [o_children addObject:[p_last_category
initWithName: o_child_name initWithName: o_child_name
withTitle: o_child_title
withHelp: o_child_help
ID: p_item->i_value ID: p_item->i_value
parent:self parent:self
children:[[NSMutableArray alloc] children:[[NSMutableArray alloc]
...@@ -311,13 +330,18 @@ static VLCTreeItem *o_root_item = nil; ...@@ -311,13 +330,18 @@ static VLCTreeItem *o_root_item = nil;
break; break;
case CONFIG_SUBCATEGORY: case CONFIG_SUBCATEGORY:
o_child_name = [[VLCMain sharedInstance] 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 && if( p_item->i_value != SUBCAT_PLAYLIST_GENERAL &&
p_item->i_value != SUBCAT_VIDEO_GENERAL && p_item->i_value != SUBCAT_VIDEO_GENERAL &&
p_item->i_value != SUBCAT_AUDIO_GENERAL ) p_item->i_value != SUBCAT_AUDIO_GENERAL )
[p_last_category->o_children [p_last_category->o_children
addObject:[[VLCTreeItem alloc] addObject:[[VLCTreeItem alloc]
initWithName: o_child_name initWithName: o_child_name
withTitle: o_child_title
withHelp: o_child_help
ID: p_item->i_value ID: p_item->i_value
parent:p_last_category parent:p_last_category
children:[[NSMutableArray alloc] children:[[NSMutableArray alloc]
...@@ -402,6 +426,10 @@ static VLCTreeItem *o_root_item = nil; ...@@ -402,6 +426,10 @@ static VLCTreeItem *o_root_item = nil;
initWithName:[[VLCMain sharedInstance] initWithName:[[VLCMain sharedInstance]
localizedString: p_module->psz_shortname ? localizedString: p_module->psz_shortname ?
p_module->psz_shortname : p_module->psz_object_name ] 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 ID: p_module->i_object_id
parent:p_subcategory_item parent:p_subcategory_item
children:IsALeafNode children:IsALeafNode
...@@ -423,6 +451,16 @@ static VLCTreeItem *o_root_item = nil; ...@@ -423,6 +451,16 @@ static VLCTreeItem *o_root_item = nil;
return o_name; return o_name;
} }
- (NSString *)getTitle
{
return o_title;
}
- (NSString *)getHelp
{
return o_help;
}
- (VLCTreeItem *)childAtIndex:(int)i_index - (VLCTreeItem *)childAtIndex:(int)i_index
{ {
return [[self children] objectAtIndex:i_index]; return [[self children] objectAtIndex:i_index];
...@@ -469,6 +507,8 @@ static VLCTreeItem *o_root_item = nil; ...@@ -469,6 +507,8 @@ static VLCTreeItem *o_root_item = nil;
NSRect s_vrc; NSRect s_vrc;
NSView *o_view; NSView *o_view;
[[VLCPrefs sharedInstance] setTitle: [self getTitle]];
/* NSLog( [self getHelp] ); */
s_vrc = [[o_prefs_view contentView] bounds]; s_vrc.size.height -= 4; s_vrc = [[o_prefs_view contentView] bounds]; s_vrc.size.height -= 4;
o_view = [[VLCFlippedView alloc] initWithFrame: s_vrc]; o_view = [[VLCFlippedView alloc] initWithFrame: s_vrc];
[o_view setAutoresizingMask: NSViewWidthSizable | NSViewMinYMargin | [o_view setAutoresizingMask: NSViewWidthSizable | NSViewMinYMargin |
...@@ -509,16 +549,17 @@ static VLCTreeItem *o_root_item = nil; ...@@ -509,16 +549,17 @@ static VLCTreeItem *o_root_item = nil;
{ {
case CONFIG_SUBCATEGORY: case CONFIG_SUBCATEGORY:
break; break;
case CONFIG_SECTION:
break;
case CONFIG_CATEGORY: case CONFIG_CATEGORY:
break; break;
case CONFIG_SECTION:
break;
case CONFIG_HINT_END: case CONFIG_HINT_END:
break; break;
case CONFIG_HINT_USAGE: case CONFIG_HINT_USAGE:
break; break;
default: default:
{ {
NSLog( @"one" );
VLCConfigControl *o_control = nil; VLCConfigControl *o_control = nil;
o_control = [VLCConfigControl newControl:p_item o_control = [VLCConfigControl newControl:p_item
withView:o_view]; withView:o_view];
...@@ -572,14 +613,14 @@ static VLCTreeItem *o_root_item = nil; ...@@ -572,14 +613,14 @@ static VLCTreeItem *o_root_item = nil;
msg_Err( p_intf, "null item found" ); msg_Err( p_intf, "null item found" );
break; break;
} }
switch(p_item->i_type) switch( p_item->i_type )
{ {
case CONFIG_SUBCATEGORY: case CONFIG_SUBCATEGORY:
break; break;
case CONFIG_SECTION:
break;
case CONFIG_CATEGORY: case CONFIG_CATEGORY:
break; break;
case CONFIG_SECTION:
break;
case CONFIG_HINT_END: case CONFIG_HINT_END:
break; break;
case CONFIG_HINT_USAGE: case CONFIG_HINT_USAGE:
......
...@@ -1936,39 +1936,27 @@ if( MACOS_VERSION >= 10.3 ) \ ...@@ -1936,39 +1936,27 @@ if( MACOS_VERSION >= 10.3 ) \
{ {
i_view_type = CONFIG_ITEM_BOOL; 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 */ /* add the label */
if( p_item->psz_text ) if( p_item->psz_text )
o_labelString = [[VLCMain sharedInstance] o_labelString = [[VLCMain sharedInstance]
localizedString: p_item->psz_text]; localizedString: p_item->psz_text];
else else
o_labelString = [NSString stringWithString:@""]; 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 ]; [o_label setAutoresizingMask:NSViewNotSizable ];
[self addSubview: o_label]; [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; 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 - (void)dealloc
{ {
[o_checkbox release]; [o_checkbox release];
......
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