Commit 53aab251 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

Mac OS X gui: Quick Preferences fix.

parent 2cc6ce41
...@@ -566,7 +566,7 @@ static VLCTreeItem *o_root_item = nil; ...@@ -566,7 +566,7 @@ static VLCTreeItem *o_root_item = nil;
msg_Err( p_intf, "invalid preference item found" ); msg_Err( p_intf, "invalid preference item found" );
break; break;
} }
if( p_item < p_end ) if( p_item > p_end )
break; break;
switch(p_item->i_type) switch(p_item->i_type)
{ {
...@@ -636,7 +636,7 @@ static VLCTreeItem *o_root_item = nil; ...@@ -636,7 +636,7 @@ static VLCTreeItem *o_root_item = nil;
msg_Err( p_intf, "invalid preference item found" ); msg_Err( p_intf, "invalid preference item found" );
break; break;
} }
if( p_item < p_end ) if( p_item > p_end )
break; break;
switch( p_item->i_type ) switch( p_item->i_type )
{ {
......
...@@ -1186,8 +1186,7 @@ ...@@ -1186,8 +1186,7 @@
[[VLCMain sharedInstance] [[VLCMain sharedInstance]
localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP]; localizedString: (char *)p_item->psz_longtext ] toWidth: PREFS_WRAP];
if( p_item->value.psz ) if( p_item->value.psz )
o_textfieldString = [[VLCMain sharedInstance] o_textfieldString = [NSString stringWithFormat: @"%s", (char *)p_item->value.psz];
localizedString: (char *)p_item->value.psz];
else else
o_textfieldString = [NSString stringWithString: @""]; o_textfieldString = [NSString stringWithString: @""];
ADD_TEXTFIELD( o_textfield, mainFrame, 12, 2, mainFrame.size.width - ADD_TEXTFIELD( o_textfield, mainFrame, 12, 2, mainFrame.size.width -
...@@ -1267,7 +1266,6 @@ ...@@ -1267,7 +1266,6 @@
int i_index; int i_index;
vlc_list_t *p_list; vlc_list_t *p_list;
module_t *p_parser; module_t *p_parser;
module_config_t *p_end;
i_view_type = CONFIG_ITEM_MODULE; i_view_type = CONFIG_ITEM_MODULE;
/* add the label */ /* add the label */
...@@ -1296,7 +1294,7 @@ ...@@ -1296,7 +1294,7 @@
for( i_index = 0; i_index < p_list->i_count; i_index++ ) for( i_index = 0; i_index < p_list->i_count; i_index++ )
{ {
p_parser = (module_t *)p_list->p_values[i_index].p_object; p_parser = (module_t *)p_list->p_values[i_index].p_object;
p_end = p_item + p_parser->confsize;
if( p_item->i_type == CONFIG_ITEM_MODULE ) if( p_item->i_type == CONFIG_ITEM_MODULE )
{ {
if( !strcmp( p_parser->psz_capability, if( !strcmp( p_parser->psz_capability,
...@@ -1313,13 +1311,14 @@ ...@@ -1313,13 +1311,14 @@
} }
else else
{ {
module_config_t *p_config; int i;
if( !strcmp( p_parser->psz_object_name, "main" ) ) if( !strcmp( p_parser->psz_object_name, "main" ) )
continue; continue;
p_config = p_parser->p_config; for ( i = 0; i < p_parser->confsize; i++ )
if( p_config ) do
{ {
module_config_t *p_config = p_parser->p_config + i;
/* Hack: required subcategory is stored in i_min */ /* Hack: required subcategory is stored in i_min */
if( p_config->i_type == CONFIG_SUBCATEGORY && if( p_config->i_type == CONFIG_SUBCATEGORY &&
p_config->value.i == p_item->min.i ) p_config->value.i == p_item->min.i )
...@@ -1332,7 +1331,7 @@ ...@@ -1332,7 +1331,7 @@
p_parser->psz_object_name) ) p_parser->psz_object_name) )
[o_popup selectItem:[o_popup lastItem]]; [o_popup selectItem:[o_popup lastItem]];
} }
} while( p_item < p_end && p_config++ ); }
} }
} }
vlc_list_release( p_list ); vlc_list_release( p_list );
...@@ -1365,16 +1364,15 @@ ...@@ -1365,16 +1364,15 @@
{ {
NSString *newval = [o_popup titleOfSelectedItem]; NSString *newval = [o_popup titleOfSelectedItem];
char *returnval = NULL; char *returnval = NULL;
int i_index; int i_module_index;
vlc_list_t *p_list; vlc_list_t *p_list;
module_t *p_parser; module_t *p_parser;
module_config_t *p_end;
p_list = vlc_list_find( VLCIntf, VLC_OBJECT_MODULE, FIND_ANYWHERE ); p_list = vlc_list_find( VLCIntf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( i_index = 0; i_index < p_list->i_count; i_index++ ) for( i_module_index = 0; i_module_index < p_list->i_count; i_module_index++ )
{ {
p_parser = (module_t *)p_list->p_values[i_index].p_object; p_parser = (module_t *)p_list->p_values[i_module_index].p_object;
p_end = p_item + p_parser->confsize;
if( p_item->i_type == CONFIG_ITEM_MODULE ) if( p_item->i_type == CONFIG_ITEM_MODULE )
{ {
if( !strcmp( p_parser->psz_capability, if( !strcmp( p_parser->psz_capability,
...@@ -1391,13 +1389,14 @@ ...@@ -1391,13 +1389,14 @@
} }
else else
{ {
module_config_t *p_config; int i;
if( !strcmp( p_parser->psz_object_name, "main" ) ) if( !strcmp( p_parser->psz_object_name, "main" ) )
continue; continue;
p_config = p_parser->p_config; for ( i = 0; i < p_parser->confsize; i++ )
if( p_config ) do
{ {
module_config_t *p_config = p_parser->p_config + i;
/* Hack: required subcategory is stored in i_min */ /* Hack: required subcategory is stored in i_min */
if( p_config->i_type == CONFIG_SUBCATEGORY && if( p_config->i_type == CONFIG_SUBCATEGORY &&
p_config->value.i == p_item->min.i ) p_config->value.i == p_item->min.i )
...@@ -1410,7 +1409,7 @@ ...@@ -1410,7 +1409,7 @@
break; break;
} }
} }
} while( p_item < p_end && p_config++ ); }
} }
} }
vlc_list_release( p_list ); vlc_list_release( p_list );
...@@ -1423,7 +1422,7 @@ ...@@ -1423,7 +1422,7 @@
withView: (NSView *)o_parent_view withView: (NSView *)o_parent_view
{ {
NSRect mainFrame = [o_parent_view frame]; NSRect mainFrame = [o_parent_view frame];
NSString *o_labelString, *o_tooltip, *o_textfieldString; NSString *o_labelString, *o_tooltip;
mainFrame.size.height = 23; mainFrame.size.height = 23;
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1; mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
mainFrame.origin.x = LEFTMARGIN; mainFrame.origin.x = LEFTMARGIN;
...@@ -1454,12 +1453,6 @@ ...@@ -1454,12 +1453,6 @@
[o_stepper setAutoresizingMask:NSViewMaxXMargin ]; [o_stepper setAutoresizingMask:NSViewMaxXMargin ];
[self addSubview: o_stepper]; [self addSubview: o_stepper];
/* build the textfield */
if( p_item->value.psz )
o_textfieldString = [[VLCMain sharedInstance]
localizedString: (char *)p_item->value.psz];
else
o_textfieldString = [NSString stringWithString: @""];
ADD_TEXTFIELD( o_textfield, mainFrame, mainFrame.size.width - 19 - 52, ADD_TEXTFIELD( o_textfield, mainFrame, mainFrame.size.width - 19 - 52,
1, 49, o_tooltip, @"" ) 1, 49, o_tooltip, @"" )
[o_textfield setIntValue: p_item->value.i]; [o_textfield setIntValue: p_item->value.i];
...@@ -1720,7 +1713,7 @@ ...@@ -1720,7 +1713,7 @@
withView: (NSView *)o_parent_view withView: (NSView *)o_parent_view
{ {
NSRect mainFrame = [o_parent_view frame]; NSRect mainFrame = [o_parent_view frame];
NSString *o_labelString, *o_tooltip, *o_textfieldString; NSString *o_labelString, *o_tooltip;
mainFrame.size.height = 23; mainFrame.size.height = 23;
mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1; mainFrame.size.width = mainFrame.size.width - LEFTMARGIN - RIGHTMARGIN + 1;
mainFrame.origin.x = LEFTMARGIN; mainFrame.origin.x = LEFTMARGIN;
...@@ -1752,11 +1745,6 @@ ...@@ -1752,11 +1745,6 @@
[self addSubview: o_stepper]; [self addSubview: o_stepper];
/* build the textfield */ /* build the textfield */
if( p_item->value.psz )
o_textfieldString = [[VLCMain sharedInstance]
localizedString: (char *)p_item->value.psz];
else
o_textfieldString = [NSString stringWithString: @""];
ADD_TEXTFIELD( o_textfield, mainFrame, mainFrame.size.width - 19 - 52, ADD_TEXTFIELD( o_textfield, mainFrame, mainFrame.size.width - 19 - 52,
1, 49, o_tooltip, @"" ) 1, 49, o_tooltip, @"" )
[o_textfield setFloatValue: p_item->value.f]; [o_textfield setFloatValue: p_item->value.f];
...@@ -2060,27 +2048,27 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST ) ...@@ -2060,27 +2048,27 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST )
//Fill our array to know how may items we have... //Fill our array to know how may items we have...
vlc_list_t *p_list; vlc_list_t *p_list;
module_t *p_parser; module_t *p_parser;
module_config_t *p_end; int i_module_index;
int i_index;
NSRect mainFrame = [o_parent_view frame]; NSRect mainFrame = [o_parent_view frame];
NSString *o_labelString, *o_textfieldString, *o_tooltip; NSString *o_labelString, *o_textfieldString, *o_tooltip;
o_modulearray = [[NSMutableArray alloc] initWithCapacity:10]; o_modulearray = [[NSMutableArray alloc] initWithCapacity:10];
/* build a list of available modules */ /* build a list of available modules */
p_list = vlc_list_find( VLCIntf, VLC_OBJECT_MODULE, FIND_ANYWHERE ); p_list = vlc_list_find( VLCIntf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( i_index = 0; i_index < p_list->i_count; i_index++ ) for( i_module_index = 0; i_module_index < p_list->i_count; i_module_index++ )
{ {
p_parser = (module_t *)p_list->p_values[i_index].p_object; int i;
p_end = p_item + p_parser->confsize; p_parser = (module_t *)p_list->p_values[i_module_index].p_object;
if( !strcmp( p_parser->psz_object_name, "main" ) ) if( !strcmp( p_parser->psz_object_name, "main" ) )
continue; continue;
module_config_t *p_config = p_parser->p_config; for ( i = 0; i < p_parser->confsize; i++ )
if( p_config ) do
{ {
module_config_t *p_config = p_parser->p_config + i;
NSString *o_modulelongname, *o_modulename; NSString *o_modulelongname, *o_modulename;
NSNumber *o_moduleenabled = nil; NSNumber *o_moduleenabled = nil;
/* Hack: required subcategory is stored in i_min */ /* Hack: required subcategory is stored in i_min */
if( p_config->i_type == CONFIG_SUBCATEGORY && if( p_config->i_type == CONFIG_SUBCATEGORY &&
p_config->value.i == _p_item->min.i ) p_config->value.i == _p_item->min.i )
...@@ -2100,7 +2088,7 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST ) ...@@ -2100,7 +2088,7 @@ if( _p_item->i_type == CONFIG_ITEM_MODULE_LIST )
arrayWithObjects: o_modulename, o_modulelongname, arrayWithObjects: o_modulename, o_modulelongname,
o_moduleenabled, nil]]; o_moduleenabled, nil]];
} }
} while( p_item < p_end && p_config++ ); }
} }
vlc_list_release( p_list ); vlc_list_release( p_list );
......
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