* added half, normal and full size videowindow menuitems.
[vlc.git] / modules / gui / macosx / controls.m
1 /*****************************************************************************
2  * controls.m: MacOS X interface plugin
3  *****************************************************************************
4  * Copyright (C) 2002 VideoLAN
5  * $Id: controls.m,v 1.20 2003/02/07 20:23:17 hartman Exp $
6  *
7  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
8  *          Christophe Massiot <massiot@via.ecp.fr>
9  *          Derk-Jan Hartman <thedj@users.sourceforge.net>
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
36 /*****************************************************************************
37  * VLCControls interface 
38  *****************************************************************************/
39 @interface VLCControls : NSObject
40 {
41     IBOutlet id o_open;
42     IBOutlet id o_main;
43
44     IBOutlet id o_volumeslider;
45 }
46
47 - (IBAction)play:(id)sender;
48 - (IBAction)stop:(id)sender;
49 - (IBAction)faster:(id)sender;
50 - (IBAction)slower:(id)sender;
51
52 - (IBAction)prev:(id)sender;
53 - (IBAction)next:(id)sender;
54 - (IBAction)loop:(id)sender;
55
56 - (IBAction)volumeUp:(id)sender;
57 - (IBAction)volumeDown:(id)sender;
58 - (IBAction)mute:(id)sender;
59 - (IBAction)volumeSliderUpdated:(id)sender;
60 - (void)updateVolumeSlider;
61
62 - (IBAction)halfWindow:(id)sender;
63 - (IBAction)normalWindow:(id)sender;
64 - (IBAction)doubleWindow:(id)sender;
65 - (IBAction)fullscreen:(id)sender;
66 - (IBAction)deinterlace:(id)sender;
67
68 - (IBAction)toggleProgram:(id)sender;
69 - (IBAction)toggleTitle:(id)sender;
70 - (IBAction)toggleChapter:(id)sender;
71 - (IBAction)toggleLanguage:(id)sender;
72 - (IBAction)toggleVar:(id)sender;
73
74 @end
75
76 /*****************************************************************************
77  * VLCControls implementation 
78  *****************************************************************************/
79 @implementation VLCControls
80
81 - (IBAction)play:(id)sender
82 {
83     intf_thread_t * p_intf = [NSApp getIntf];
84
85     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
86                                                        FIND_ANYWHERE );
87     if( p_playlist == NULL )
88     {
89         return;
90     }
91
92     if( playlist_IsPlaying( p_playlist ) )
93     {
94         playlist_Pause( p_playlist );
95         vlc_object_release( p_playlist );
96     }
97     else
98     {
99         if( !playlist_IsEmpty( p_playlist ) )
100         {
101             playlist_Play( p_playlist );
102             vlc_object_release( p_playlist );
103         }
104         else
105         {
106             vlc_object_release( p_playlist );
107             [o_open openFile: nil];
108         }
109     }
110 }
111
112 - (IBAction)stop:(id)sender
113 {
114     intf_thread_t * p_intf = [NSApp getIntf];
115
116     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
117                                                        FIND_ANYWHERE );
118     if( p_playlist == NULL )
119     {
120         return;
121     }
122
123     playlist_Stop( p_playlist );
124     vlc_object_release( p_playlist );
125 }
126
127 - (IBAction)faster:(id)sender
128 {
129     intf_thread_t * p_intf = [NSApp getIntf];
130
131     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
132                                                        FIND_ANYWHERE );
133     if( p_playlist == NULL )
134     {
135         return;
136     }
137
138     vlc_mutex_lock( &p_playlist->object_lock );
139     if( p_playlist->p_input != NULL )
140     {
141         input_SetStatus( p_playlist->p_input, INPUT_STATUS_FASTER );
142     } 
143     vlc_mutex_unlock( &p_playlist->object_lock );
144
145     vlc_object_release( p_playlist );
146 }
147
148 - (IBAction)slower:(id)sender
149 {
150     intf_thread_t * p_intf = [NSApp getIntf];
151
152     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
153                                                        FIND_ANYWHERE );
154     if( p_playlist == NULL )
155     {
156         return;
157     }
158
159     vlc_mutex_lock( &p_playlist->object_lock );
160     if( p_playlist->p_input != NULL )
161     {
162         input_SetStatus( p_playlist->p_input, INPUT_STATUS_SLOWER );
163     }
164     vlc_mutex_unlock( &p_playlist->object_lock );
165
166     vlc_object_release( p_playlist );
167 }
168
169 - (IBAction)prev:(id)sender
170 {
171     intf_thread_t * p_intf = [NSApp getIntf];
172
173     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
174                                                        FIND_ANYWHERE );
175     if( p_playlist == NULL )
176     {
177         return;
178     }
179
180     vlc_mutex_lock( &p_playlist->object_lock );
181
182     if( p_playlist->p_input == NULL )
183     {
184         vlc_mutex_unlock( &p_playlist->object_lock );
185         vlc_object_release( p_playlist );  
186         return;
187     }
188
189     vlc_mutex_lock( &p_playlist->p_input->stream.stream_lock );
190
191 #define p_area p_playlist->p_input->stream.p_selected_area
192
193     if( p_area->i_part_nb > 1 && p_area->i_part > 1 )
194     {
195         p_area->i_part--;
196
197         vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
198         input_ChangeArea( p_playlist->p_input, p_area );
199         vlc_mutex_unlock( &p_playlist->object_lock );
200
201         p_intf->p_sys->b_chapter_update = VLC_TRUE;
202     }
203     else
204     {
205         vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
206         vlc_mutex_unlock( &p_playlist->object_lock );
207         playlist_Prev( p_playlist );
208     }
209
210 #undef p_area
211
212     vlc_object_release( p_playlist );
213 }
214
215 - (IBAction)next:(id)sender
216 {
217     intf_thread_t * p_intf = [NSApp getIntf];
218
219     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
220                                                        FIND_ANYWHERE );
221     if( p_playlist == NULL )
222     {
223         return;
224     }
225
226     vlc_mutex_lock( &p_playlist->object_lock );
227
228     if( p_playlist->p_input == NULL )
229     {
230         vlc_mutex_unlock( &p_playlist->object_lock );
231         vlc_object_release( p_playlist );  
232         return;
233     }
234
235     vlc_mutex_lock( &p_playlist->p_input->stream.stream_lock );
236
237 #define p_area p_playlist->p_input->stream.p_selected_area
238
239     if( p_area->i_part_nb > 1 && p_area->i_part + 1 < p_area->i_part_nb )
240     {
241         p_area->i_part++;
242
243         vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
244         input_ChangeArea( p_playlist->p_input, p_area );
245         vlc_mutex_unlock( &p_playlist->object_lock );
246
247         p_intf->p_sys->b_chapter_update = VLC_TRUE;
248     }
249     else
250     {
251         vlc_mutex_unlock( &p_playlist->p_input->stream.stream_lock );
252         vlc_mutex_unlock( &p_playlist->object_lock );
253         playlist_Next( p_playlist );
254     }
255
256 #undef p_area
257
258     vlc_object_release( p_playlist );
259 }
260
261 - (IBAction)loop:(id)sender
262 {
263     intf_thread_t * p_intf = [NSApp getIntf];
264
265     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
266                                                        FIND_ANYWHERE );
267     if( p_playlist == NULL )
268     {
269         return;
270     }
271
272     config_PutInt( p_playlist, "loop",
273                    !config_GetInt( p_playlist, "loop" ) );
274
275     vlc_object_release( p_playlist );
276 }
277
278 - (IBAction)volumeUp:(id)sender
279 {
280     intf_thread_t * p_intf = [NSApp getIntf];
281
282     aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
283                                                         FIND_ANYWHERE );
284     if( p_aout != NULL )
285     {
286         if( p_intf->p_sys->b_mute )
287         {
288             [self mute: nil];
289         }
290
291         aout_VolumeUp( p_aout, 1, NULL );
292         vlc_object_release( (vlc_object_t *)p_aout );
293     }
294
295     [self updateVolumeSlider];
296 }
297
298 - (IBAction)volumeDown:(id)sender
299 {
300     intf_thread_t * p_intf = [NSApp getIntf];
301
302     aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
303                                                         FIND_ANYWHERE );
304     if( p_aout != NULL )
305     {
306         if( p_intf->p_sys->b_mute )
307         {
308             [self mute: nil];
309         }
310
311         aout_VolumeDown( p_aout, 1, NULL );
312         vlc_object_release( (vlc_object_t *)p_aout );
313     }
314
315     [self updateVolumeSlider];
316 }
317
318 - (IBAction)mute:(id)sender
319 {
320     intf_thread_t * p_intf = [NSApp getIntf];
321
322     aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
323                                                         FIND_ANYWHERE );
324
325     if ( p_aout != NULL )
326     {
327         audio_volume_t i_volume;
328
329         aout_VolumeMute( p_aout, &i_volume );
330         vlc_object_release( (vlc_object_t *)p_aout );
331
332         p_intf->p_sys->b_mute = ( i_volume == 0 );
333     }
334
335     [self updateVolumeSlider];
336 }
337
338 - (IBAction)volumeSliderUpdated:(id)sender
339 {
340     intf_thread_t * p_intf = [NSApp getIntf];
341
342     aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
343                                                         FIND_ANYWHERE );
344     if( p_aout != NULL )
345     {
346         audio_volume_t i_volume;
347
348         i_volume = (audio_volume_t)[sender intValue];
349
350         aout_VolumeSet( p_aout, i_volume * AOUT_VOLUME_STEP );
351         vlc_object_release( (vlc_object_t *)p_aout );
352     }
353 }
354
355 - (void)updateVolumeSlider
356 {
357     intf_thread_t * p_intf = [NSApp getIntf];
358
359     aout_instance_t * p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
360                                                         FIND_ANYWHERE );
361
362     if ( p_aout != NULL )
363     {
364         audio_volume_t i_volume;
365
366         aout_VolumeGet( p_aout, &i_volume );
367         vlc_object_release( (vlc_object_t *)p_aout );
368
369         [o_volumeslider setFloatValue: (float)(i_volume / AOUT_VOLUME_STEP)]; 
370     }
371 }
372
373 - (IBAction)halfWindow:(id)sender
374 {
375     id o_window = [NSApp keyWindow];
376     NSArray *o_windows = [NSApp windows];
377     NSEnumerator *o_enumerator = [o_windows objectEnumerator];
378     
379     while ((o_window = [o_enumerator nextObject]))
380     {
381         if( [[o_window className] isEqualToString: @"VLCWindow"] )
382         {
383             [o_window halfWindow];
384         }
385     }
386 }
387
388 - (IBAction)normalWindow:(id)sender
389 {
390     id o_window = [NSApp keyWindow];
391     NSArray *o_windows = [NSApp windows];
392     NSEnumerator *o_enumerator = [o_windows objectEnumerator];
393     
394     while ((o_window = [o_enumerator nextObject]))
395     {
396         if( [[o_window className] isEqualToString: @"VLCWindow"] )
397         {
398             [o_window normalWindow];
399         }
400     }
401 }
402
403 - (IBAction)doubleWindow:(id)sender
404 {
405     id o_window = [NSApp keyWindow];
406     NSArray *o_windows = [NSApp windows];
407     NSEnumerator *o_enumerator = [o_windows objectEnumerator];
408     
409     while ((o_window = [o_enumerator nextObject]))
410     {
411         if( [[o_window className] isEqualToString: @"VLCWindow"] )
412         {
413             [o_window doubleWindow];
414         }
415     }
416 }
417
418
419 - (IBAction)fullscreen:(id)sender
420 {
421     id o_window = [NSApp keyWindow];
422     NSArray *o_windows = [NSApp windows];
423     NSEnumerator *o_enumerator = [o_windows objectEnumerator];
424     
425     while ((o_window = [o_enumerator nextObject]))
426     {
427         if( [[o_window className] isEqualToString: @"VLCWindow"] )
428         {
429             [o_window toggleFullscreen];
430         }
431     }
432 }
433
434 - (IBAction)deinterlace:(id)sender
435 {
436
437 }
438
439 - (IBAction)toggleProgram:(id)sender
440 {
441     NSMenuItem * o_mi = (NSMenuItem *)sender;
442     intf_thread_t * p_intf = [NSApp getIntf];
443
444     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
445                                                        FIND_ANYWHERE );
446     if( p_playlist == NULL )
447     {
448         return;
449     }
450
451     vlc_mutex_lock( &p_playlist->object_lock );
452
453     if( p_playlist->p_input == NULL )
454     {
455         vlc_mutex_unlock( &p_playlist->object_lock );
456         vlc_object_release( p_playlist );
457         return;
458     }
459
460     if( [o_mi state] == NSOffState )
461     {
462         u16 i_program_id = [o_mi tag];
463
464         input_ChangeProgram( p_playlist->p_input, i_program_id );
465         input_SetStatus( p_playlist->p_input, INPUT_STATUS_PLAY );
466     }
467
468     vlc_mutex_unlock( &p_playlist->object_lock );
469     vlc_object_release( p_playlist );
470 }
471
472 - (IBAction)toggleTitle:(id)sender
473 {
474     NSMenuItem * o_mi = (NSMenuItem *)sender;
475     intf_thread_t * p_intf = [NSApp getIntf];
476
477     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
478                                                        FIND_ANYWHERE );
479     if( p_playlist == NULL )
480     {
481         return;
482     }
483
484     vlc_mutex_lock( &p_playlist->object_lock );
485
486     if( p_playlist->p_input == NULL )
487     {
488         vlc_mutex_unlock( &p_playlist->object_lock );
489         vlc_object_release( p_playlist );
490         return;
491     }
492
493     if( [o_mi state] == NSOffState )
494     {
495         int i_title = [o_mi tag];
496
497 #define p_input p_playlist->p_input
498         input_ChangeArea( p_input, p_input->stream.pp_areas[i_title] );
499         input_SetStatus( p_input, INPUT_STATUS_PLAY );
500 #undef p_input
501     }
502
503     vlc_mutex_unlock( &p_playlist->object_lock );
504     vlc_object_release( p_playlist );
505 }
506
507 - (IBAction)toggleChapter:(id)sender
508 {
509     NSMenuItem * o_mi = (NSMenuItem *)sender;
510     intf_thread_t * p_intf = [NSApp getIntf];
511
512     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
513                                                        FIND_ANYWHERE );
514     if( p_playlist == NULL )
515     {
516         return;
517     }
518
519     vlc_mutex_lock( &p_playlist->object_lock );
520
521     if( p_playlist->p_input == NULL )
522     {
523         vlc_mutex_unlock( &p_playlist->object_lock );
524         vlc_object_release( p_playlist );
525         return;
526     }
527
528     if( [o_mi state] == NSOffState )
529     {
530         int i_chapter = [o_mi tag];
531
532 #define p_input p_playlist->p_input
533         p_input->stream.p_selected_area->i_part = i_chapter;
534         input_ChangeArea( p_input, p_input->stream.p_selected_area );
535         input_SetStatus( p_input, INPUT_STATUS_PLAY );
536 #undef p_input
537     }
538
539     vlc_mutex_unlock( &p_playlist->object_lock );
540     vlc_object_release( p_playlist );
541 }
542
543 - (IBAction)toggleLanguage:(id)sender
544 {
545     NSMenuItem * o_mi = (NSMenuItem *)sender;
546     intf_thread_t * p_intf = [NSApp getIntf];
547
548     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
549                                                        FIND_ANYWHERE );
550     if( p_playlist == NULL )
551     {
552         return;
553     }
554
555     vlc_mutex_lock( &p_playlist->object_lock );
556
557     if( p_playlist->p_input == NULL )
558     {
559         vlc_mutex_unlock( &p_playlist->object_lock );
560         vlc_object_release( p_playlist );
561         return;
562     }
563
564 #if 0
565     /* We do not use this code, because you need to start stop .avi for
566      * it to work, so not very useful now  --hartman */
567     if ( [o_mi state] == NSOffState && [o_mi tag] == 2000 )
568     {
569         NSOpenPanel *o_open_panel = [NSOpenPanel openPanel];
570         
571         [o_open_panel setAllowsMultipleSelection: NO];
572         [o_open_panel setTitle: _NS("Open subtitlefile")];
573         [o_open_panel setPrompt: _NS("Open")];
574     
575         if( [o_open_panel runModalForDirectory: nil 
576                 file: nil types: nil] == NSOKButton )
577         {
578             NSString *o_filename = [[o_open_panel filenames] objectAtIndex: 0];
579             config_PutPsz( p_intf, "sub-file", strdup( [o_filename cString] ));
580         }
581     }
582 #endif
583
584 #define p_input p_playlist->p_input
585
586     if( !p_intf->p_sys->b_audio_update )
587     {
588         NSValue * o_value = [o_mi representedObject];
589         es_descriptor_t * p_es = [o_value pointerValue];
590
591         if( [o_mi state] == NSOnState )
592         {
593             /* we just have one ES to disable */
594             input_ToggleES( p_input, p_es, 0 );
595         }
596         else
597         {
598             unsigned int i;
599             int i_cat = [o_mi tag];
600
601             vlc_mutex_lock( &p_input->stream.stream_lock );
602
603 #define ES p_input->stream.pp_selected_es[i]
604
605             /* unselect the selected ES in the same class */
606             for( i = 0; i < p_input->stream.i_selected_es_number; i++ )
607             {
608                 if( ES->i_cat == i_cat )
609                 {
610                     vlc_mutex_unlock( &p_input->stream.stream_lock );
611                     input_ToggleES( p_input, ES, 0 );
612                     vlc_mutex_lock( &p_input->stream.stream_lock );
613                     break;
614                 }
615             }
616
617 #undef ES
618
619             vlc_mutex_unlock( &p_input->stream.stream_lock );
620
621             input_ToggleES( p_input, p_es, 1 );
622         }
623     }
624
625 #undef p_input
626
627     vlc_mutex_unlock( &p_playlist->object_lock );
628     vlc_object_release( p_playlist );
629 }
630
631 - (IBAction)toggleVar:(id)sender
632 {
633     NSMenuItem * o_mi = (NSMenuItem *)sender;
634     
635     if( [o_mi state] == NSOffState )
636     {
637         const char * psz_variable = (const char *)[o_mi tag];
638         const char * psz_value = [[o_mi title] cString];
639         vlc_object_t * p_object = (vlc_object_t *)
640             [[o_mi representedObject] pointerValue];
641         vlc_value_t val;
642         /* psz_string sucks */
643         val.psz_string = (char *)psz_value;
644
645         if ( var_Set( p_object, psz_variable, val ) < 0 )
646         {
647             msg_Warn( p_object, "cannot set variable (%s)", psz_value );
648         }
649     }
650 }
651
652 @end
653
654 @implementation VLCControls (NSMenuValidation)
655  
656 - (BOOL)validateMenuItem:(NSMenuItem *)o_mi
657 {
658     BOOL bEnabled = TRUE;
659     NSMenu * o_menu = [o_mi menu];
660     intf_thread_t * p_intf = [NSApp getIntf];
661
662     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
663                                                        FIND_ANYWHERE );
664
665     if( p_playlist != NULL )
666     {
667         vlc_mutex_lock( &p_playlist->object_lock );
668     }
669
670 #define p_input p_playlist->p_input
671
672     if( [[o_mi title] isEqualToString: _NS("Faster")] ||
673         [[o_mi title] isEqualToString: _NS("Slower")] )
674     {
675         if( p_playlist != NULL && p_input != NULL )
676         {
677             vlc_mutex_lock( &p_input->stream.stream_lock );
678             bEnabled = p_input->stream.b_pace_control;
679             vlc_mutex_unlock( &p_input->stream.stream_lock );
680         }
681         else
682         {
683             bEnabled = FALSE;
684         }
685     }
686     else if( [[o_mi title] isEqualToString: _NS("Stop")] )
687     {
688         if( p_playlist == NULL || p_input == NULL )
689         {
690             bEnabled = FALSE;
691         }
692     }
693     else if( [[o_mi title] isEqualToString: _NS("Previous")] ||
694              [[o_mi title] isEqualToString: _NS("Next")] )
695     {
696         if( p_playlist == NULL )
697         {
698             bEnabled = FALSE;
699         }
700         else
701         {
702             bEnabled = p_playlist->i_size > 1;
703
704             if( p_input != NULL )
705             {
706                 vlc_mutex_lock( &p_input->stream.stream_lock );
707                 bEnabled |= p_input->stream.p_selected_area->i_part_nb > 1;
708                 vlc_mutex_unlock( &p_input->stream.stream_lock );
709             }
710         }
711     }
712     else if( [[o_mi title] isEqualToString: _NS("Loop")] )
713     {
714         int i_state = config_GetInt( p_playlist, "loop" ) ?
715                       NSOnState : NSOffState;
716
717         [o_mi setState: i_state];
718     }
719     else if( [[o_mi title] isEqualToString: _NS("Volume Up")] ||
720              [[o_mi title] isEqualToString: _NS("Volume Down")] ) 
721     {
722         aout_instance_t * p_aout;
723
724         p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
725                                           FIND_ANYWHERE );
726         if( p_aout != NULL )
727         {
728             vlc_object_release( (vlc_object_t *)p_aout );
729         }
730         else
731         {
732             bEnabled = FALSE;
733         }
734     }
735     else if( [[o_mi title] isEqualToString: _NS("Mute")] ) 
736     {
737         aout_instance_t * p_aout;
738
739         p_aout = vlc_object_find( p_intf, VLC_OBJECT_AOUT,
740                                           FIND_ANYWHERE );
741         if( p_aout != NULL )
742         {
743             vlc_object_release( (vlc_object_t *)p_aout );
744         }
745         else
746         {
747             bEnabled = FALSE;
748         }
749
750         [o_mi setState: p_intf->p_sys->b_mute ? NSOnState : NSOffState];
751     }
752     else if( [[o_mi title] isEqualToString: _NS("Fullscreen")] ||
753                 [[o_mi title] isEqualToString: _NS("Half Size")] ||
754                 [[o_mi title] isEqualToString: _NS("Normal Size")] ||
755                 [[o_mi title] isEqualToString: _NS("Double Size")])    
756     {
757         id o_window;
758         NSArray *o_windows = [NSApp windows];
759         NSEnumerator *o_enumerator = [o_windows objectEnumerator];
760         bEnabled = FALSE;
761         
762         while ((o_window = [o_enumerator nextObject]))
763         {
764             if( [[o_window className] isEqualToString: @"VLCWindow"] )
765             {
766                 bEnabled = TRUE;
767                 break;
768             }
769         }
770     }
771     else if( o_menu != nil && 
772              [[o_menu title] isEqualToString: _NS("Deinterlace")] )
773     { 
774
775     } 
776
777     if( p_playlist != NULL )
778     {
779         vlc_mutex_unlock( &p_playlist->object_lock );
780         vlc_object_release( p_playlist );
781     }
782
783     return( bEnabled );
784 }
785
786 @end