* controls.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
- * $Id: controls.m,v 1.34 2003/05/01 01:11:17 hartman Exp $
+ * $Id: controls.m,v 1.35 2003/05/05 22:04:11 hartman Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
- (IBAction)toggleVar:(id)sender
{
- NSMenuItem * o_mi = (NSMenuItem *)sender;
+ NSMenuItem *o_mi = (NSMenuItem *)sender;
+ NSMenu *o_mu = [o_mi menu];
if( [o_mi state] == NSOffState )
{
- const char * psz_variable = (const char *)[o_mi tag];
- char * psz_value = [NSApp delocalizeString: [o_mi title]];
+ const char * psz_variable = (const char *)
+ [[[o_mu supermenu] itemWithTitle: [o_mu title]] tag];
vlc_object_t * p_object = (vlc_object_t *)
[[o_mi representedObject] pointerValue];
vlc_value_t val;
- /* psz_string sucks */
- val.psz_string = (char *)psz_value;
+ val.i_int = (int)[o_mi tag];
if ( var_Set( p_object, psz_variable, val ) < 0 )
{
- msg_Warn( p_object, "cannot set variable (%s)", psz_value );
+ msg_Warn( p_object, "cannot set variable %s: with %d", psz_variable, val.i_int );
}
-
- free( psz_value );
+ if (psz_variable) free(psz_variable);
}
}
* intf.m: MacOS X interface plugin
*****************************************************************************
* Copyright (C) 2002-2003 VideoLAN
- * $Id: intf.m,v 1.72 2003/05/04 22:42:16 gbazin Exp $
+ * $Id: intf.m,v 1.73 2003/05/05 22:04:11 hartman Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr>
var_Set( (vlc_object_t *)p_aout, "intf-change", val );
-#error fixme! look at rc.c line 823
[self setupVarMenu: o_mi_channels target: (vlc_object_t *)p_aout
var: "audio-channels" selector: @selector(toggleVar:)];
var:(const char *)psz_variable
selector:(SEL)pf_callback
{
- int i, i_nb_items;
+ int i, i_nb_items, i_value;
NSMenu * o_menu = [o_mi submenu];
- vlc_value_t val;
- char * psz_value;
-
+ vlc_value_t val, text;
+
+ [o_mi setTag: (int)psz_variable];
+
/* remove previous items */
i_nb_items = [o_menu numberOfItems];
for( i = 0; i < i_nb_items; i++ )
{
return;
}
- psz_value = val.psz_string;
+ i_value = val.i_int;
if ( var_Change( p_object, psz_variable,
- VLC_VAR_GETLIST, &val, NULL ) < 0 )
+ VLC_VAR_GETLIST, &val, &text ) < 0 )
{
- free( psz_value );
return;
}
NSMenuItem * o_lmi;
NSString * o_title;
- o_title = [NSApp localizedString: val.p_list->p_values[i].psz_string];
- o_lmi = [o_menu addItemWithTitle: o_title
+ o_title = [NSApp localizedString: text.p_list->p_values[i].psz_string];
+
+ o_lmi = [o_menu addItemWithTitle: [o_title copy]
action: pf_callback keyEquivalent: @""];
+
/* FIXME: this isn't 64-bit clean ! */
- [o_lmi setTag: (int)psz_variable];
+ [o_lmi setTag: val.p_list->p_values[i].i_int];
[o_lmi setRepresentedObject:
[NSValue valueWithPointer: p_object]];
[o_lmi setTarget: o_controls];
- if ( !strcmp( psz_value, val.p_list->p_values[i].psz_string ) )
+ if ( i_value == val.p_list->p_values[i].i_int )
[o_lmi setState: NSOnState];
}
var_Change( p_object, psz_variable, VLC_VAR_FREELIST,
- &val, NULL );
+ &val, &text );
- free( psz_value );
}
- (IBAction)clearRecentItems:(id)sender
* vout.m: MacOS X video output plugin
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
- * $Id: vout.m,v 1.46 2003/05/04 22:42:16 gbazin Exp $
+ * $Id: vout.m,v 1.47 2003/05/05 22:04:11 hartman Exp $
*
* Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org>
if( [o_screens count] > 0 && var_Type( p_vout, "video-device" ) == 0 )
{
int i = 1;
- vlc_value_t val;
+ vlc_value_t val, text;
NSScreen * o_screen;
int i_option = config_GetInt( p_vout, "macosx-vdev" );
- var_Create( p_vout, "video-device", VLC_VAR_STRING |
+ var_Create( p_vout, "video-device", VLC_VAR_INTEGER |
VLC_VAR_HASCHOICE );
-
+ text.psz_string = _("Video device");
+ var_Change( p_vout, "video-device", VLC_VAR_SETTEXT, &text, NULL );
+
NSEnumerator * o_enumerator = [o_screens objectEnumerator];
while( (o_screen = [o_enumerator nextObject]) != NULL )
"%s %d (%dx%d)", _("Screen"), i,
(int)s_rect.size.width, (int)s_rect.size.height );
- val.psz_string = psz_temp;
+ text.psz_string = psz_temp;
+ val.i_int = i;
var_Change( p_vout, "video-device",
- VLC_VAR_ADDCHOICE, &val, NULL );
+ VLC_VAR_ADDCHOICE, &val, &text );
if( ( i - 1 ) == i_option )
{
var_Set( p_vout, "video-device", val );
}
-
i++;
}
}
else
{
- unsigned int i_index = 0;
NSArray *o_screens = [NSScreen screens];
-
- if( !sscanf( val.psz_string, _("Screen %d"), &i_index ) ||
- [o_screens count] < i_index )
+ unsigned int i_index = val.i_int;
+
+ if( [o_screens count] < i_index )
{
o_screen = [NSScreen mainScreen];
b_main_screen = 1;
o_screen = [o_screens objectAtIndex: i_index];
config_PutInt( p_vout, "macosx-vdev", i_index );
b_main_screen = (i_index == 0);
- }
-
- free( val.psz_string );
+ }
}
if( p_vout->b_fullscreen )