Commit 45d50b96 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* fixed the autogenerated menu's.

parent d5a0f848
......@@ -2,7 +2,7 @@
* 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>
......@@ -611,24 +611,23 @@
- (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);
}
}
......
......@@ -2,7 +2,7 @@
* 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>
......@@ -1186,7 +1186,6 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
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:)];
......@@ -1309,10 +1308,11 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
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];
......@@ -1325,12 +1325,11 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
{
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;
}
......@@ -1342,23 +1341,24 @@ int ExecuteOnMainThread( id target, SEL sel, void * p_arg )
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
......
......@@ -2,7 +2,7 @@
* 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>
......@@ -181,13 +181,15 @@ int E_(OpenVideo) ( vlc_object_t *p_this )
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];
......@@ -200,15 +202,15 @@ int E_(OpenVideo) ( vlc_object_t *p_this )
"%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++;
}
......@@ -1215,11 +1217,10 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
}
else
{
unsigned int i_index = 0;
NSArray *o_screens = [NSScreen screens];
unsigned int i_index = val.i_int;
if( !sscanf( val.psz_string, _("Screen %d"), &i_index ) ||
[o_screens count] < i_index )
if( [o_screens count] < i_index )
{
o_screen = [NSScreen mainScreen];
b_main_screen = 1;
......@@ -1231,8 +1232,6 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
config_PutInt( p_vout, "macosx-vdev", i_index );
b_main_screen = (i_index == 0);
}
free( val.psz_string );
}
if( p_vout->b_fullscreen )
......
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