]> git.sesse.net Git - vlc/blob - modules/gui/macosx/controls.m
* Fullscreen button works again
[vlc] / modules / gui / macosx / controls.m
1 /*****************************************************************************
2  * controls.m: MacOS X interface module
3  *****************************************************************************
4  * Copyright (C) 2002-2003 VideoLAN
5  * $Id$
6  *
7  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
8  *          Christophe Massiot <massiot@via.ecp.fr>
9  *          Derk-Jan Hartman <hartman at videolan dot org>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  * 
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
24  *****************************************************************************/
25
26 /*****************************************************************************
27  * Preamble
28  *****************************************************************************/
29 #include <stdlib.h>                                      /* malloc(), free() */
30 #include <sys/param.h>                                    /* for MAXPATHLEN */
31 #include <string.h>
32
33 #include "intf.h"
34 #include "vout.h"
35 #include "open.h"
36 #include "controls.h"
37 #include <osd.h>
38
39 /*****************************************************************************
40  * VLCControls implementation 
41  *****************************************************************************/
42 @implementation VLCControls
43
44 - (IBAction)play:(id)sender
45 {
46     vlc_value_t val;
47     intf_thread_t * p_intf = VLCIntf;
48     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
49                                         FIND_ANYWHERE );
50     if( p_playlist )
51     {
52         vlc_mutex_lock( &p_playlist->object_lock );
53         if( p_playlist->i_size <= 0 )
54         {
55             vlc_mutex_unlock( &p_playlist->object_lock );
56             vlc_object_release( p_playlist );
57             [o_open openFileGeneric: nil];
58         }
59         else
60         {
61             vlc_mutex_unlock( &p_playlist->object_lock );
62             vlc_object_release( p_playlist );
63         }
64
65     }
66     val.i_int = config_GetInt( p_intf, "key-play-pause" );
67     var_Set( p_intf->p_vlc, "key-pressed", val );
68 }
69
70 - (IBAction)stop:(id)sender
71 {
72     vlc_value_t val;
73     intf_thread_t * p_intf = VLCIntf;
74     val.i_int = config_GetInt( p_intf, "key-stop" );
75     var_Set( p_intf->p_vlc, "key-pressed", val );
76 }
77
78 - (IBAction)faster:(id)sender
79 {
80     vlc_value_t val;
81     intf_thread_t * p_intf = VLCIntf;
82     val.i_int = config_GetInt( p_intf, "key-faster" );
83     var_Set( p_intf->p_vlc, "key-pressed", val );
84 }
85
86 - (IBAction)slower:(id)sender
87 {
88     vlc_value_t val;
89     intf_thread_t * p_intf = VLCIntf;
90     val.i_int = config_GetInt( p_intf, "key-slower" );
91     var_Set( p_intf->p_vlc, "key-pressed", val );
92 }
93
94 - (IBAction)prev:(id)sender
95 {
96     vlc_value_t val;
97     intf_thread_t * p_intf = VLCIntf;
98     val.i_int = config_GetInt( p_intf, "key-prev" );
99     var_Set( p_intf->p_vlc, "key-pressed", val );
100 }
101
102 - (IBAction)next:(id)sender
103 {
104     vlc_value_t val;
105     intf_thread_t * p_intf = VLCIntf;
106     val.i_int = config_GetInt( p_intf, "key-next" );
107     var_Set( p_intf->p_vlc, "key-pressed", val );
108 }
109
110 - (IBAction)random:(id)sender
111 {
112     vlc_value_t val;
113     intf_thread_t * p_intf = VLCIntf;
114     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
115                                                        FIND_ANYWHERE );
116     if( p_playlist == NULL )
117     {
118         return;
119     }
120
121     var_Get( p_playlist, "random", &val );
122     val.b_bool = !val.b_bool;
123     var_Set( p_playlist, "random", val );
124     if( val.b_bool )
125     {
126         vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Random On" ) );
127     }
128     else
129     {
130         vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Random Off" ) );
131     }    
132
133     p_intf->p_sys->b_playlist_update = VLC_TRUE;
134     p_intf->p_sys->b_intf_update = VLC_TRUE;
135     vlc_object_release( p_playlist );
136 }
137
138 - (IBAction)repeat:(id)sender
139 {
140     vlc_value_t val;
141     intf_thread_t * p_intf = VLCIntf;
142     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
143                                                        FIND_ANYWHERE );
144     if( p_playlist == NULL )
145     {
146         return;
147     }
148
149     var_Get( p_playlist, "repeat", &val );
150     if (!val.b_bool)
151     {   
152         var_Set( p_playlist, "loop", val );
153     } 
154     val.b_bool = !val.b_bool;
155     var_Set( p_playlist, "repeat", val );
156     if( val.b_bool )
157     {
158         vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat All" ) );
159     }
160     else
161     {
162         vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat Off" ) );
163     }
164
165     p_intf->p_sys->b_playlist_update = VLC_TRUE;    
166     p_intf->p_sys->b_intf_update = VLC_TRUE;
167     vlc_object_release( p_playlist );
168 }
169
170 - (IBAction)loop:(id)sender
171 {
172     vlc_value_t val;
173     intf_thread_t * p_intf = VLCIntf;
174     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
175                                                        FIND_ANYWHERE );
176     if( p_playlist == NULL )
177     {
178         return;
179     }
180
181     var_Get( p_playlist, "loop", &val );
182     if (!val.b_bool)
183     {
184         var_Set( p_playlist, "repeat", val );
185     }
186     val.b_bool = !val.b_bool;
187     var_Set( p_playlist, "loop", val );
188     if( val.b_bool )
189     {
190         vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat One" ) );
191     }
192     else
193     {
194         vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat Off" ) );
195     }    
196
197     p_intf->p_sys->b_playlist_update = VLC_TRUE;
198     p_intf->p_sys->b_intf_update = VLC_TRUE;
199     vlc_object_release( p_playlist );
200 }
201
202 - (IBAction)forward:(id)sender
203 {
204     vlc_value_t val;
205     intf_thread_t * p_intf = VLCIntf;
206     val.i_int = config_GetInt( p_intf, "key-jump+10sec" );
207     var_Set( p_intf->p_vlc, "key-pressed", val );
208 }
209
210 - (IBAction)backward:(id)sender
211 {
212     vlc_value_t val;
213     intf_thread_t * p_intf = VLCIntf;
214     val.i_int = config_GetInt( p_intf, "key-jump-10sec" );
215     var_Set( p_intf->p_vlc, "key-pressed", val );
216 }
217
218
219 - (IBAction)volumeUp:(id)sender
220 {
221     vlc_value_t val;
222     intf_thread_t * p_intf = VLCIntf;
223     val.i_int = config_GetInt( p_intf, "key-vol-up" );
224     var_Set( p_intf->p_vlc, "key-pressed", val );
225     [self updateVolumeSlider];
226 }
227
228 - (IBAction)volumeDown:(id)sender
229 {
230     vlc_value_t val;
231     intf_thread_t * p_intf = VLCIntf;
232     val.i_int = config_GetInt( p_intf, "key-vol-down" );
233     var_Set( p_intf->p_vlc, "key-pressed", val );
234     [self updateVolumeSlider];
235 }
236
237 - (IBAction)mute:(id)sender
238 {
239     vlc_value_t val;
240     intf_thread_t * p_intf = VLCIntf;
241     val.i_int = config_GetInt( p_intf, "key-vol-mute" );
242     var_Set( p_intf->p_vlc, "key-pressed", val );
243     [self updateVolumeSlider];
244 }
245
246 - (IBAction)volumeSliderUpdated:(id)sender
247 {
248     intf_thread_t * p_intf = VLCIntf;
249     audio_volume_t i_volume = (audio_volume_t)[sender intValue];
250
251     aout_VolumeSet( p_intf, i_volume * AOUT_VOLUME_STEP );
252 }
253
254 - (void)updateVolumeSlider
255 {
256     intf_thread_t * p_intf = VLCIntf;
257     audio_volume_t i_volume;
258
259     aout_VolumeGet( p_intf, &i_volume );
260
261     [o_volumeslider setFloatValue: (float)(i_volume / AOUT_VOLUME_STEP)];
262 }
263
264 - (IBAction)windowAction:(id)sender
265 {
266     id o_window = [NSApp keyWindow];
267     NSString *o_title = [sender title];
268     NSArray *o_windows = [NSApp orderedWindows];
269     NSEnumerator *o_enumerator = [o_windows objectEnumerator];
270     vout_thread_t *p_vout = vlc_object_find( VLCIntf, VLC_OBJECT_VOUT,
271                                               FIND_ANYWHERE );
272
273     playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
274                                               FIND_ANYWHERE );
275
276     if( p_vout != NULL )
277     {
278         while ((o_window = [o_enumerator nextObject]))
279         {
280             if( [[o_window className] isEqualToString: @"VLCWindow"] )
281             {
282                 if( [o_title isEqualToString: _NS("Half Size") ] )
283                     [o_window scaleWindowWithFactor: 0.5];
284                 else if( [o_title isEqualToString: _NS("Normal Size") ] )
285                     [o_window scaleWindowWithFactor: 1.0];
286                 else if( [o_title isEqualToString: _NS("Double Size") ] )
287                     [o_window scaleWindowWithFactor: 2.0];
288                 else if( [o_title isEqualToString: _NS("Float on Top") ] )
289                     [o_window toggleFloatOnTop];
290                 else if( [o_title isEqualToString: _NS("Fit to Screen") ] )
291                 {
292                     if( ![o_window isZoomed] )
293                         [o_window performZoom:self];
294                 }
295                 else
296                 {
297                     vlc_value_t val;
298                     var_Get( p_vout, "fullscreen", &val );
299                     var_Set( p_vout, "fullscreen", (vlc_value_t)!val.b_bool );
300                 }
301                 break;
302             }
303         }
304         vlc_object_release( (vlc_object_t *)p_vout );
305         if (p_playlist) vlc_object_release(p_playlist);
306     }
307
308     else if ( p_playlist != NULL )
309     {
310         if (! ([o_title isEqualToString: _NS("Half Size") ] ||
311                [o_title isEqualToString: _NS("Normal Size") ] ||
312                [o_title isEqualToString: _NS("Double Size") ] ||
313                [o_title isEqualToString: _NS("Float on Top") ] ||
314                [o_title isEqualToString: _NS("Fit to Screen") ] ))
315         {
316             vlc_value_t val;
317             var_Get( p_playlist, "fullscreen", &val );
318             var_Set( p_playlist, "fullscreen", (vlc_value_t)!val.b_bool );
319         }
320     vlc_object_release( (vlc_object_t *)p_playlist );
321     }
322
323 }
324
325 - (void)setupVarMenuItem:(NSMenuItem *)o_mi
326                     target:(vlc_object_t *)p_object
327                     var:(const char *)psz_variable
328                     selector:(SEL)pf_callback
329 {
330     vlc_value_t val, text;
331     int i_type = var_Type( p_object, psz_variable );
332
333     switch( i_type & VLC_VAR_TYPE )
334     {
335     case VLC_VAR_VOID:
336     case VLC_VAR_BOOL:
337     case VLC_VAR_VARIABLE:
338     case VLC_VAR_STRING:
339     case VLC_VAR_INTEGER:
340         break;
341     default:
342         /* Variable doesn't exist or isn't handled */
343         return;
344     }
345     
346     /* Make sure we want to display the variable */
347     if( i_type & VLC_VAR_HASCHOICE )
348     {
349         var_Change( p_object, psz_variable, VLC_VAR_CHOICESCOUNT, &val, NULL );
350         if( val.i_int == 0 ) return;
351         if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 )
352             return;
353     }
354     
355     /* Get the descriptive name of the variable */
356     var_Change( p_object, psz_variable, VLC_VAR_GETTEXT, &text, NULL );
357     [o_mi setTitle: [[VLCMain sharedInstance] localizedString: text.psz_string ?
358                                         text.psz_string : strdup( psz_variable ) ]];
359
360     var_Get( p_object, psz_variable, &val );
361     if( i_type & VLC_VAR_HASCHOICE )
362     {
363         NSMenu *o_menu = [o_mi submenu];
364
365         [self setupVarMenu: o_menu forMenuItem: o_mi target:p_object
366                         var:psz_variable selector:pf_callback];
367         
368         if( text.psz_string ) free( text.psz_string );
369         return;
370     }
371
372     VLCMenuExt *o_data;
373     switch( i_type & VLC_VAR_TYPE )
374     {
375     case VLC_VAR_VOID:
376         o_data = [[VLCMenuExt alloc] initWithVar: psz_variable Object: p_object->i_object_id
377                 Value: val ofType: i_type];
378         [o_mi setRepresentedObject: [NSValue valueWithPointer:[o_data retain]]];
379         break;
380
381     case VLC_VAR_BOOL:
382         o_data = [[VLCMenuExt alloc] initWithVar: psz_variable Object: p_object->i_object_id
383                 Value: val ofType: i_type];
384         [o_mi setRepresentedObject: [NSValue valueWithPointer:[o_data retain]]];
385         if( !( i_type & VLC_VAR_ISCOMMAND ) )
386             [o_mi setState: val.b_bool ? TRUE : FALSE ];
387         break;
388
389     default:
390         if( text.psz_string ) free( text.psz_string );
391         return;
392     }
393
394     if( ( i_type & VLC_VAR_TYPE ) == VLC_VAR_STRING ) free( val.psz_string );
395     if( text.psz_string ) free( text.psz_string );
396 }
397
398
399 - (void)setupVarMenu:(NSMenu *)o_menu
400                     forMenuItem: (NSMenuItem *)o_parent
401                     target:(vlc_object_t *)p_object
402                     var:(const char *)psz_variable
403                     selector:(SEL)pf_callback
404 {
405     vlc_value_t val, val_list, text_list;
406     int i_type, i, i_nb_items;
407
408     /* remove previous items */
409     i_nb_items = [o_menu numberOfItems];
410     for( i = 0; i < i_nb_items; i++ )
411     {
412         [o_menu removeItemAtIndex: 0];
413     }
414
415     /* Check the type of the object variable */
416     i_type = var_Type( p_object, psz_variable );
417
418     /* Make sure we want to display the variable */
419     if( i_type & VLC_VAR_HASCHOICE )
420     {
421         var_Change( p_object, psz_variable, VLC_VAR_CHOICESCOUNT, &val, NULL );
422         if( val.i_int == 0 ) return;
423         if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 )
424             return;
425     }
426     else
427     {
428         return;
429     }
430
431     switch( i_type & VLC_VAR_TYPE )
432     {
433     case VLC_VAR_VOID:
434     case VLC_VAR_BOOL:
435     case VLC_VAR_VARIABLE:
436     case VLC_VAR_STRING:
437     case VLC_VAR_INTEGER:
438         break;
439     default:
440         /* Variable doesn't exist or isn't handled */
441         return;
442     }
443
444     if( var_Get( p_object, psz_variable, &val ) < 0 )
445     {
446         return;
447     }
448
449     if( var_Change( p_object, psz_variable, VLC_VAR_GETLIST,
450                     &val_list, &text_list ) < 0 )
451     {
452         if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
453         return;
454     }
455
456     /* make (un)sensitive */
457     [o_parent setEnabled: ( val_list.p_list->i_count > 1 )];
458
459     for( i = 0; i < val_list.p_list->i_count; i++ )
460     {
461         vlc_value_t another_val;
462         NSMenuItem * o_lmi;
463         NSString *o_title = @"";
464         VLCMenuExt *o_data;
465
466         switch( i_type & VLC_VAR_TYPE )
467         {
468         case VLC_VAR_STRING:
469             another_val.psz_string =
470                 strdup(val_list.p_list->p_values[i].psz_string);
471
472             o_title = [[VLCMain sharedInstance] localizedString: text_list.p_list->p_values[i].psz_string ?
473                 text_list.p_list->p_values[i].psz_string : val_list.p_list->p_values[i].psz_string ];
474
475             o_lmi = [o_menu addItemWithTitle: o_title action: pf_callback keyEquivalent: @""];
476             o_data = [[VLCMenuExt alloc] initWithVar: strdup(psz_variable) Object: p_object->i_object_id
477                     Value: another_val ofType: i_type];
478             [o_lmi setRepresentedObject: [NSValue valueWithPointer:[o_data retain]]];
479             [o_lmi setTarget: self];
480             
481             if( !strcmp( val.psz_string, val_list.p_list->p_values[i].psz_string ) && !( i_type & VLC_VAR_ISCOMMAND ) )
482                 [o_lmi setState: TRUE ];
483
484             break;
485
486         case VLC_VAR_INTEGER:
487
488              o_title = text_list.p_list->p_values[i].psz_string ?
489                                  [[VLCMain sharedInstance] localizedString: strdup( text_list.p_list->p_values[i].psz_string )] :
490                                  [NSString stringWithFormat: @"%d",
491                                  val_list.p_list->p_values[i].i_int];
492
493             o_lmi = [[o_menu addItemWithTitle: o_title action: pf_callback keyEquivalent: @""] retain ];
494             o_data = [[VLCMenuExt alloc] initWithVar: strdup(psz_variable) Object: p_object->i_object_id
495                     Value: val_list.p_list->p_values[i] ofType: i_type];
496             [o_lmi setRepresentedObject: [NSValue valueWithPointer:[ o_data retain]]];
497             [o_lmi setTarget: self];
498
499             if( val_list.p_list->p_values[i].i_int == val.i_int && !( i_type & VLC_VAR_ISCOMMAND ) )
500                 [o_lmi setState: TRUE ];
501             break;
502
503         default:
504           break;
505         }
506     }
507     
508     /* clean up everything */
509     if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
510     var_Change( p_object, psz_variable, VLC_VAR_FREELIST, &val_list, &text_list );
511 }
512
513 - (IBAction)toggleVar:(id)sender
514 {
515     NSMenuItem *o_mi = (NSMenuItem *)sender;
516     VLCMenuExt *o_data = [[o_mi representedObject] pointerValue];
517     [NSThread detachNewThreadSelector: @selector(toggleVarThread:)
518         toTarget: self withObject: o_data];
519
520     return;
521 }
522
523 - (int)toggleVarThread: (id)_o_data
524 {
525     vlc_object_t *p_object;
526     NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
527     VLCMenuExt *o_data = (VLCMenuExt *)_o_data;
528
529     vlc_thread_set_priority( VLCIntf , VLC_THREAD_PRIORITY_LOW );
530
531     p_object = (vlc_object_t *)vlc_object_get( VLCIntf,
532                                     [o_data objectID] );
533
534     if( p_object != NULL )
535     {
536         var_Set( p_object, strdup([o_data name]), [o_data value] );
537         vlc_object_release( p_object );
538         [o_pool release];
539         return VLC_TRUE;
540     }
541     [o_pool release];
542     return VLC_EGENERIC;
543 }
544
545 @end
546
547 @implementation VLCControls (NSMenuValidation)
548  
549 - (BOOL)validateMenuItem:(NSMenuItem *)o_mi
550 {
551     BOOL bEnabled = TRUE;
552     vlc_value_t val;
553     intf_thread_t * p_intf = VLCIntf;
554     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
555                                                        FIND_ANYWHERE );
556
557     if( p_playlist != NULL )
558     {
559         vlc_mutex_lock( &p_playlist->object_lock );
560     }
561
562 #define p_input p_playlist->p_input
563
564     if( [[o_mi title] isEqualToString: _NS("Faster")] ||
565         [[o_mi title] isEqualToString: _NS("Slower")] )
566     {
567         if( p_playlist != NULL && p_input != NULL )
568         {
569             bEnabled = p_input->input.b_can_pace_control;
570         }
571         else
572         {
573             bEnabled = FALSE;
574         }
575     }
576     else if( [[o_mi title] isEqualToString: _NS("Stop")] )
577     {
578         if( p_playlist == NULL || p_input == NULL )
579         {
580             bEnabled = FALSE;
581         }
582     }
583     else if( [[o_mi title] isEqualToString: _NS("Previous")] ||
584              [[o_mi title] isEqualToString: _NS("Next")] )
585     {
586         if( p_playlist == NULL )
587         {
588             bEnabled = FALSE;
589         }
590         else
591         {
592             bEnabled = p_playlist->i_size > 1;
593         }
594     }
595     else if( [[o_mi title] isEqualToString: _NS("Random")] )
596     {
597         int i_state;
598         var_Get( p_playlist, "random", &val );
599         i_state = val.b_bool ? NSOnState : NSOffState;
600         [o_mi setState: i_state];
601     }
602     else if( [[o_mi title] isEqualToString: _NS("Repeat One")] )
603     {
604         int i_state;
605         var_Get( p_playlist, "repeat", &val );
606         i_state = val.b_bool ? NSOnState : NSOffState;
607         [o_mi setState: i_state];
608     }
609     else if( [[o_mi title] isEqualToString: _NS("Repeat All")] )
610     {
611         int i_state;
612         var_Get( p_playlist, "loop", &val );
613         i_state = val.b_bool ? NSOnState : NSOffState;
614         [o_mi setState: i_state];
615     }
616     else if( [[o_mi title] isEqualToString: _NS("Step Forward")] ||
617              [[o_mi title] isEqualToString: _NS("Step Backward")] )
618     {
619         bEnabled = FALSE;
620         if( p_playlist != NULL && p_input != NULL )
621         {
622             var_Get( p_input, "seekable", &val);
623             if( val.b_bool )
624             {
625                 bEnabled = TRUE;
626             }
627         }
628     }
629     else if( [[o_mi title] isEqualToString: _NS("Mute")] ) 
630     {
631         [o_mi setState: p_intf->p_sys->b_mute ? NSOnState : NSOffState];
632     }
633     else if( [[o_mi title] isEqualToString: _NS("Half Size")] ||
634                 [[o_mi title] isEqualToString: _NS("Normal Size")] ||
635                 [[o_mi title] isEqualToString: _NS("Double Size")] ||
636                 [[o_mi title] isEqualToString: _NS("Fit to Screen")] ||
637                 [[o_mi title] isEqualToString: _NS("Float on Top")] )
638     {
639         id o_window;
640         NSArray *o_windows = [NSApp orderedWindows];
641         NSEnumerator *o_enumerator = [o_windows objectEnumerator];
642         bEnabled = FALSE;
643         
644         vout_thread_t   *p_vout = vlc_object_find( p_intf, VLC_OBJECT_VOUT,
645                                               FIND_ANYWHERE );
646         if( p_vout != NULL )
647         {
648             if ( [[o_mi title] isEqualToString: _NS("Float on Top")] )
649             {
650                 var_Get( p_vout, "video-on-top", &val );
651                 [o_mi setState: val.b_bool ?  NSOnState : NSOffState];
652             }
653
654             while ((o_window = [o_enumerator nextObject]))
655             {
656                 if( [[o_window className] isEqualToString: @"VLCWindow"] )
657                 {
658                     bEnabled = TRUE;
659                     break;
660                 }
661             }
662             vlc_object_release( (vlc_object_t *)p_vout );
663         }
664     }
665     else if( [[o_mi title] isEqualToString: _NS("Fullscreen")])
666     {
667         if (p_playlist)
668         {
669             var_Get(p_playlist, "fullscreen", &val );
670             [o_mi setState: val.b_bool];
671             bEnabled = TRUE;
672         }
673         else
674         {
675             bEnabled = FALSE;
676         }
677     }
678
679
680     if( p_playlist != NULL )
681     {
682         vlc_mutex_unlock( &p_playlist->object_lock );
683         vlc_object_release( p_playlist );
684     }
685
686     return( bEnabled );
687 }
688
689 @end
690
691 /*****************************************************************************
692  * VLCMenuExt implementation 
693  *****************************************************************************
694  * Object connected to a playlistitem which remembers the data belonging to
695  * the variable of the autogenerated menu
696  *****************************************************************************/
697 @implementation VLCMenuExt
698
699 - (id)initWithVar: (const char *)_psz_name Object: (int)i_id
700         Value: (vlc_value_t)val ofType: (int)_i_type
701 {
702     self = [super init];
703
704     if( self != nil )
705     {
706         psz_name = strdup( _psz_name );
707         i_object_id = i_id;
708         value = val;
709         i_type = _i_type;
710     }
711
712     return( self );
713 }
714
715 - (void)dealloc
716 {
717     free( psz_name );
718 }
719
720 - (char *)name
721 {
722     return psz_name;
723 }
724
725 - (int)objectID
726 {
727     return i_object_id;
728 }
729
730 - (vlc_value_t)value
731 {
732     return value;
733 }
734
735 - (int)type
736 {
737     return i_type;
738 }
739
740 @end