]> git.sesse.net Git - vlc/blob - modules/gui/macosx/playlist.m
* fixes item deletion when pressing backspace. Doesn't work for nodes yet
[vlc] / modules / gui / macosx / playlist.m
1 /*****************************************************************************
2  * playlist.m: MacOS X interface module
3  *****************************************************************************
4  * Copyright (C) 2002-2004 VideoLAN
5  * $Id$
6  *
7  * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
8  *          Derk-Jan Hartman <hartman at videolan dot org>
9  *          Benjamin Pracht <bigben at videolab 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 /* TODO
27  * connect delegates, actions and outlets in IB
28  * implement delete by backspace
29  * implement playlist item rightclick menu
30  * implement sorting
31  * add 'icons' for different types of nodes? (http://www.cocoadev.com/index.pl?IconAndTextInTableCell)
32  * create a new 'playlist toggle' that hides the playlist and in effect give you the old controller
33  * create a new search field build with pictures from the 'regular' search field, so it can be emulated on 10.2
34  * create toggle buttons for the shuffle, repeat one, repeat all functions.
35  * implement drag and drop and item reordering.
36  * reimplement enable/disable item
37  * create a new 'tool' button (see the gear button in the Finder window) for 'actions'
38    (adding service discovery, other views, new node/playlist, save node/playlist) stuff like that
39  */
40
41
42
43 /*****************************************************************************
44  * Preamble
45  *****************************************************************************/
46 #include <stdlib.h>                                      /* malloc(), free() */
47 #include <sys/param.h>                                    /* for MAXPATHLEN */
48 #include <string.h>
49 #include <math.h>
50 #include <sys/mount.h>
51 #include <vlc_keys.h>
52
53 #include "intf.h"
54 #include "playlist.h"
55 #include "controls.h"
56 #include <OSD.h>
57
58 /*****************************************************************************
59  * VLCPlaylistView implementation 
60  *****************************************************************************/
61 @implementation VLCPlaylistView
62
63 - (NSMenu *)menuForEvent:(NSEvent *)o_event
64 {
65     return( [[self delegate] menuForEvent: o_event] );
66 }
67
68 - (void)keyDown:(NSEvent *)o_event
69 {
70     unichar key = 0;
71     int i, c, i_row;
72     NSMutableArray *o_to_delete;
73     NSNumber *o_number;
74
75     playlist_t * p_playlist;
76     intf_thread_t * p_intf = VLCIntf;
77 msg_Dbg( p_intf, "KEYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY");
78     if( [[o_event characters] length] )
79     {
80         key = [[o_event characters] characterAtIndex: 0];
81     }
82
83     p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
84                                           FIND_ANYWHERE );
85
86     if ( p_playlist == NULL )
87     {
88         return;
89     }
90
91     switch( key )
92     {
93         case NSDeleteCharacter:
94         case NSDeleteFunctionKey:
95         case NSDeleteCharFunctionKey:
96         case NSBackspaceCharacter:
97             o_to_delete = [NSMutableArray arrayWithArray:[[self selectedRowEnumerator] allObjects]];
98             c = [o_to_delete count];
99
100             for( i = 0; i < c; i++ ) {
101                 playlist_item_t * p_item;
102                 o_number = [o_to_delete lastObject];
103                 i_row = [o_number intValue];
104
105                 if( p_playlist->status.p_item == [[self itemAtRow: i_row] pointerValue] && p_playlist->status.i_status )
106                 {
107                     playlist_Stop( p_playlist );
108                 }
109                 [o_to_delete removeObject: o_number];
110                 [self deselectRow: i_row];
111                 p_item = (playlist_item_t *)[[self itemAtRow: i_row]pointerValue];
112                 playlist_Delete( p_playlist, p_item->input.i_id );
113                 [self reloadData];
114             }
115             break;
116
117         default:
118             [super keyDown: o_event];
119             break;
120     }
121
122     if( p_playlist != NULL )
123     {
124         vlc_object_release( p_playlist );
125     }
126 }
127
128
129 @end
130
131 /*****************************************************************************
132  * VLCPlaylist implementation 
133  *****************************************************************************/
134 @implementation VLCPlaylist
135
136 - (id)init
137 {
138     self = [super init];
139     if ( self !=nil )
140     {
141         //i_moveRow = -1;
142     }
143     return self;
144 }
145
146 - (void)awakeFromNib
147 {
148     [o_outline_view setTarget: self];
149     [o_outline_view setDelegate: self];
150     [o_outline_view setDataSource: self];
151
152     [o_outline_view setDoubleAction: @selector(playItem:)];
153
154     [o_outline_view registerForDraggedTypes: 
155         [NSArray arrayWithObjects: NSFilenamesPboardType, nil]];
156     [o_outline_view setIntercellSpacing: NSMakeSize (0.0, 1.0)];
157
158 /* We need to check whether _defaultTableHeaderSortImage exists, since it 
159 belongs to an Apple hidden private API, and then can "disapear" at any time*/
160
161     if( [[NSOutlineView class] respondsToSelector:@selector(_defaultTableHeaderSortImage)] )
162     {
163         o_ascendingSortingImage = [[NSOutlineView class] _defaultTableHeaderSortImage];
164     }
165     else
166     {
167         o_ascendingSortingImage = nil;
168     }
169
170     if( [[NSOutlineView class] respondsToSelector:@selector(_defaultTableHeaderReverseSortImage)] )
171     {
172         o_descendingSortingImage = [[NSOutlineView class] _defaultTableHeaderReverseSortImage];
173     }
174     else
175     {
176         o_descendingSortingImage = nil;
177     }
178
179     o_outline_dict = [[NSMutableDictionary alloc] init];
180
181     [self initStrings];
182     //[self playlistUpdated];
183 }
184
185 - (void)initStrings
186 {
187     [o_mi_save_playlist setTitle: _NS("Save Playlist...")];
188 #if 0
189     [o_mi_play setTitle: _NS("Play")];
190     [o_mi_delete setTitle: _NS("Delete")];
191     [o_mi_selectall setTitle: _NS("Select All")];
192     [o_mi_toggleItemsEnabled setTitle: _NS("Item Enabled")];
193     [o_mi_enableGroup setTitle: _NS("Enable all group items")];
194     [o_mi_disableGroup setTitle: _NS("Disable all group items")];
195     [o_mi_info setTitle: _NS("Properties")];
196 #endif
197     [[o_tc_name headerCell] setStringValue:_NS("Name")];
198     [[o_tc_author headerCell] setStringValue:_NS("Author")];
199     [[o_tc_duration headerCell] setStringValue:_NS("Duration")];
200     [o_status_field setStringValue: [NSString stringWithFormat:
201                         _NS("0 items in playlist")]];
202
203     [o_random_ckb setTitle: _NS("Random")];
204 #if 0
205     [o_search_button setTitle: _NS("Search")];
206 #endif
207     [o_btn_playlist setToolTip: _NS("Playlist")];
208     [[o_loop_popup itemAtIndex:0] setTitle: _NS("Standard Play")];
209     [[o_loop_popup itemAtIndex:1] setTitle: _NS("Repeat One")];
210     [[o_loop_popup itemAtIndex:2] setTitle: _NS("Repeat All")];
211 }
212
213 - (void)playlistUpdated
214 {
215     [o_outline_view reloadData];
216 }
217
218 - (IBAction)playItem:(id)sender
219 {
220     intf_thread_t * p_intf = VLCIntf;
221     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
222                                                        FIND_ANYWHERE );
223
224     if( p_playlist != NULL )
225     {
226         playlist_item_t *p_item;
227         playlist_view_t *p_view;
228         p_view = playlist_ViewFind( p_playlist, VIEW_SIMPLE );
229         p_item = [[o_outline_view itemAtRow:[o_outline_view selectedRow]] pointerValue];
230         
231         if( p_item )
232             playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, VIEW_SIMPLE, p_view ? p_view->p_root : NULL, p_item );
233         vlc_object_release( p_playlist );
234     }
235 }
236
237 - (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue
238 {
239     int i_item;
240     intf_thread_t * p_intf = VLCIntf;
241     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
242                                                        FIND_ANYWHERE );
243
244     if( p_playlist == NULL )
245     {
246         return;
247     }
248
249     for ( i_item = 0; i_item < (int)[o_array count]; i_item++ )
250     {
251         /* One item */
252         NSDictionary *o_one_item;
253         int j, i_total_options = 0, i_new_id = -1;
254         int i_mode = PLAYLIST_INSERT;
255         BOOL b_rem = FALSE, b_dir = FALSE;
256         NSString *o_uri, *o_name;
257         NSArray *o_options;
258         NSURL *o_true_file;
259         char **ppsz_options = NULL;
260
261         /* Get the item */
262         o_one_item = [o_array objectAtIndex: i_item];
263         o_uri = (NSString *)[o_one_item objectForKey: @"ITEM_URL"];
264         o_name = (NSString *)[o_one_item objectForKey: @"ITEM_NAME"];
265         o_options = (NSArray *)[o_one_item objectForKey: @"ITEM_OPTIONS"];
266
267         /* If no name, then make a guess */
268         if( !o_name) o_name = [[NSFileManager defaultManager] displayNameAtPath: o_uri];
269
270         if( [[NSFileManager defaultManager] fileExistsAtPath:o_uri isDirectory:&b_dir] && b_dir &&
271             [[NSWorkspace sharedWorkspace] getFileSystemInfoForPath: o_uri isRemovable: &b_rem
272                     isWritable:NULL isUnmountable:NULL description:NULL type:NULL] && b_rem   )
273         {
274             /* All of this is to make sure CD's play when you D&D them on VLC */
275             /* Converts mountpoint to a /dev file */
276             struct statfs *buf;
277             char *psz_dev;
278             buf = (struct statfs *) malloc (sizeof(struct statfs));
279             statfs( [o_uri fileSystemRepresentation], buf );
280             psz_dev = strdup(buf->f_mntfromname);
281             o_uri = [NSString stringWithCString: psz_dev ];
282         }
283
284         if( o_options && [o_options count] > 0 )
285         {
286             /* Count the input options */
287             i_total_options = [o_options count];
288
289             /* Allocate ppsz_options */
290             for( j = 0; j < i_total_options; j++ )
291             {
292                 if( !ppsz_options )
293                     ppsz_options = (char **)malloc( sizeof(char *) * i_total_options );
294
295                 ppsz_options[j] = strdup([[o_options objectAtIndex:j] UTF8String]);
296             }
297         }
298
299         /* Add the item */
300         i_new_id = playlist_AddExt( p_playlist, [o_uri fileSystemRepresentation],
301                       [o_name UTF8String], i_mode,
302                       i_position == -1 ? PLAYLIST_END : i_position + i_item,
303                       0, (ppsz_options != NULL ) ? (const char **)ppsz_options : 0, i_total_options );
304
305         /* clean up
306         for( j = 0; j < i_total_options; j++ )
307             free( ppsz_options[j] );
308         if( ppsz_options ) free( ppsz_options ); */
309
310         /* Recent documents menu */
311         o_true_file = [NSURL fileURLWithPath: o_uri];
312         if( o_true_file != nil )
313         {
314             [[NSDocumentController sharedDocumentController]
315                 noteNewRecentDocumentURL: o_true_file];
316         }
317
318         if( i_item == 0 && !b_enqueue )
319         {
320             playlist_Goto( p_playlist, playlist_GetPositionById( p_playlist, i_new_id ) );
321             playlist_Play( p_playlist );
322         }
323     }
324
325     vlc_object_release( p_playlist );
326 }
327
328 - (IBAction)handlePopUp:(id)sender
329
330 {
331              intf_thread_t * p_intf = VLCIntf;
332              vlc_value_t val1,val2;
333              playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
334                                                         FIND_ANYWHERE );
335              if( p_playlist == NULL )
336              {
337                  return;
338              }
339
340     switch ([o_loop_popup indexOfSelectedItem])
341     {
342         case 1:
343
344              val1.b_bool = 0;
345              var_Set( p_playlist, "loop", val1 );
346              val1.b_bool = 1;
347              var_Set( p_playlist, "repeat", val1 );
348              vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat One" ) );
349         break;
350
351         case 2:
352              val1.b_bool = 0;
353              var_Set( p_playlist, "repeat", val1 );
354              val1.b_bool = 1;
355              var_Set( p_playlist, "loop", val1 );
356              vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat All" ) );
357         break;
358
359         default:
360              var_Get( p_playlist, "repeat", &val1 );
361              var_Get( p_playlist, "loop", &val2 );
362              if (val1.b_bool || val2.b_bool)
363              {
364                   val1.b_bool = 0;
365                   var_Set( p_playlist, "repeat", val1 );
366                   var_Set( p_playlist, "loop", val1 );
367                   vout_OSDMessage( p_intf, DEFAULT_CHAN, _( "Repeat Off" ) );
368              }
369          break;
370      }
371      vlc_object_release( p_playlist );
372      [self playlistUpdated];
373 }
374
375 - (NSMutableArray *)subSearchItem:(playlist_item_t *)p_item
376 {
377     playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
378                                                        FIND_ANYWHERE );
379     playlist_item_t * p_selected_item;
380     int i_current, i_selected_row;
381
382     if (!p_playlist)
383         return NULL;
384
385     i_selected_row = [o_outline_view selectedRow];
386     if (i_selected_row < 0)
387         i_selected_row = 0;
388
389     p_selected_item = (playlist_item_t *)[[o_outline_view itemAtRow:
390                                             i_selected_row] pointerValue];
391
392     for (i_current = 0; i_current < p_item->i_children ; i_current++)
393     {
394         char * psz_temp;
395         NSString * o_current_name, * o_current_author;
396
397         vlc_mutex_lock( &p_playlist->object_lock );
398         o_current_name = [NSString stringWithUTF8String:
399             p_item->pp_children[i_current]->input.psz_name];
400         psz_temp = playlist_ItemGetInfo(p_item ,_("Meta-information"),_("Author") );
401         o_current_author = [NSString stringWithUTF8String: psz_temp];
402         free( psz_temp);
403         vlc_mutex_unlock( &p_playlist->object_lock );
404
405         if (p_selected_item == p_item->pp_children[i_current] &&
406                     b_selected_item_met == NO)
407         {
408             b_selected_item_met = YES;
409         }
410         else if (p_selected_item == p_item->pp_children[i_current] &&
411                     b_selected_item_met == YES)
412         {
413             vlc_object_release(p_playlist);
414             return NULL;
415         }
416         else if (b_selected_item_met == YES &&
417                     ([o_current_name rangeOfString:[o_search_field
418                         stringValue] options:NSCaseInsensitiveSearch ].length ||
419                     [o_current_author rangeOfString:[o_search_field
420                         stringValue] options:NSCaseInsensitiveSearch ].length))
421         {
422             vlc_object_release(p_playlist);
423             /*Adds the parent items in the result array as well, so that we can
424             expand the tree*/
425             return [NSMutableArray arrayWithObject: [NSValue
426                             valueWithPointer: p_item->pp_children[i_current]]];
427         }
428         if (p_item->pp_children[i_current]->i_children > 0)
429         {
430             id o_result = [self subSearchItem:
431                                             p_item->pp_children[i_current]];
432             if (o_result != NULL)
433             {
434                 vlc_object_release(p_playlist);
435                 [o_result insertObject: [NSValue valueWithPointer:
436                                 p_item->pp_children[i_current]] atIndex:0];
437                 return o_result;
438             }
439         }
440     }
441     vlc_object_release(p_playlist);
442     return NULL;
443 }
444
445 - (IBAction)searchItem:(id)sender
446 {
447     playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
448                                                        FIND_ANYWHERE );
449     playlist_view_t * p_view;
450     id o_result;
451
452     unsigned int i;
453     int i_row = -1;
454
455     b_selected_item_met = NO;
456
457     if( p_playlist == NULL )
458         return;
459
460     p_view = playlist_ViewFind( p_playlist, VIEW_SIMPLE );
461
462     if (p_view)
463     {
464         /*First, only search after the selected item:*
465          *(b_selected_item_met = NO)                 */
466         o_result = [self subSearchItem:p_view->p_root];
467         if (o_result == NULL)
468         {
469             /* If the first search failed, search again from the beginning */
470             o_result = [self subSearchItem:p_view->p_root];
471         }
472         if (o_result != NULL)
473         {
474             for (i = 0 ; i < [o_result count] - 1 ; i++)
475             {
476                 [o_outline_view expandItem: [o_outline_dict objectForKey:
477                             [NSString stringWithFormat: @"%p",
478                             [[o_result objectAtIndex: i] pointerValue]]]];
479             }
480             i_row = [o_outline_view rowForItem: [o_outline_dict objectForKey:
481                             [NSString stringWithFormat: @"%p",
482                             [[o_result objectAtIndex: [o_result count] - 1 ]
483                             pointerValue]]]];
484         }
485         if (i_row > -1)
486         {
487             [o_outline_view selectRow:i_row byExtendingSelection: NO];
488             [o_outline_view scrollRowToVisible: i_row];
489         }
490     }
491     vlc_object_release(p_playlist);
492
493 }
494
495 @end
496
497 @implementation VLCPlaylist (NSOutlineViewDataSource)
498
499 /* return the number of children for Obj-C pointer item */ /* DONE */
500 - (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
501 {
502     int i_return = 0;
503     playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
504                                                        FIND_ANYWHERE );
505     if( p_playlist == NULL )
506         return 0;
507
508     if( item == nil )
509     {
510         /* root object */
511         playlist_view_t *p_view;
512         p_view = playlist_ViewFind( p_playlist, VIEW_SIMPLE );
513         if( p_view && p_view->p_root )
514             i_return = p_view->p_root->i_children;
515     }
516     else
517     {
518         playlist_item_t *p_item = (playlist_item_t *)[item pointerValue];
519         if( p_item )
520             i_return = p_item->i_children;
521     }
522     vlc_object_release( p_playlist );
523     if( i_return == -1 ) i_return = 0;
524     msg_Dbg( p_playlist, "I have %d children", i_return );
525     return i_return;
526 }
527
528 /* return the child at index for the Obj-C pointer item */ /* DONE */
529 - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item
530 {
531     playlist_item_t *p_return = NULL;
532     playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
533                                                        FIND_ANYWHERE );
534     NSValue * o_value;
535
536     if( p_playlist == NULL )
537         return nil;
538
539     if( item == nil )
540     {
541         /* root object */
542         playlist_view_t *p_view;
543         p_view = playlist_ViewFind( p_playlist, VIEW_SIMPLE );
544         if( p_view && index < p_view->p_root->i_children )
545             p_return = p_view->p_root->pp_children[index];
546     }
547     else
548     {
549         playlist_item_t *p_item = (playlist_item_t *)[item pointerValue];
550         if( p_item && index < p_item->i_children )
551         {
552             p_return = p_item->pp_children[index];
553         }
554     }
555
556     [o_status_field setStringValue: [NSString stringWithFormat:
557                         _NS("%i items in playlist"), p_playlist->i_size]];
558
559     vlc_object_release( p_playlist );
560     msg_Dbg( p_playlist, "childitem with index %d", index );
561
562     o_value = [NSValue valueWithPointer: p_return];
563
564     [o_outline_dict setObject:o_value forKey:[NSString stringWithFormat:@"%p",                                                                      p_return]];
565     return o_value;
566 }
567
568 /* is the item expandable */
569 - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
570 {
571     int i_return = 0;
572     playlist_t * p_playlist = vlc_object_find( VLCIntf, VLC_OBJECT_PLAYLIST,
573                                                        FIND_ANYWHERE );
574     if( p_playlist == NULL )
575         return NO;
576
577     if( item == nil )
578     {
579         /* root object */
580         playlist_view_t *p_view;
581         p_view = playlist_ViewFind( p_playlist, VIEW_SIMPLE );
582         if( p_view && p_view->p_root )
583             i_return = p_view->p_root->i_children;
584     }
585     else
586     {
587         playlist_item_t *p_item = (playlist_item_t *)[item pointerValue];
588         if( p_item )
589             i_return = p_item->i_children;
590     }
591     vlc_object_release( p_playlist );
592
593     if( i_return == -1 || i_return == 0 )
594         return NO;
595     else
596         return YES;
597 }
598
599 /* retrieve the string values for the cells */
600 - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)o_tc byItem:(id)item
601 {
602     id o_value = nil;
603     intf_thread_t * p_intf = VLCIntf;
604     playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
605                                                FIND_ANYWHERE );
606     playlist_item_t *p_item = (playlist_item_t *)[item pointerValue];
607
608     if( p_playlist == NULL || p_item == NULL )
609     {
610         return( @"error" );
611     }
612
613     if( [[o_tc identifier] isEqualToString:@"1"] )
614     {
615         o_value = [NSString stringWithUTF8String:
616             p_item->input.psz_name];
617         if( o_value == NULL )
618             o_value = [NSString stringWithCString:
619                 p_item->input.psz_name];
620     }
621     else if( [[o_tc identifier] isEqualToString:@"2"] )
622     {
623         char *psz_temp;
624         psz_temp = playlist_ItemGetInfo( p_item ,_("Meta-information"),_("Artist") );
625
626         if( psz_temp == NULL )
627             o_value = @"";
628         else
629         {
630             o_value = [NSString stringWithUTF8String: psz_temp];
631             if( o_value == NULL )
632             {
633                 o_value = [NSString stringWithCString: psz_temp];
634             }
635             free( psz_temp );
636         }
637     }
638     else if( [[o_tc identifier] isEqualToString:@"3"] )
639     {
640         char psz_duration[MSTRTIME_MAX_SIZE];
641         mtime_t dur = p_item->input.i_duration;
642         if( dur != -1 )
643         {
644             secstotimestr( psz_duration, dur/1000000 );
645             o_value = [NSString stringWithUTF8String: psz_duration];
646         }
647         else
648         {
649             o_value = @"-:--:--";
650         }
651     }
652
653     vlc_object_release( p_playlist );
654
655     return( o_value );
656 }
657
658 /* Required for drag & drop and reordering */
659 - (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard
660 {
661     return NO;
662 }
663
664 - (NSDragOperation)outlineView:(NSOutlineView *)outlineView validateDrop:(id <NSDraggingInfo>)info proposedItem:(id)item proposedChildIndex:(int)index
665 {
666     return NSDragOperationNone;
667 }
668
669 /* Delegate method of NSWindow */
670 - (void)windowWillClose:(NSNotification *)aNotification
671 {
672     [o_btn_playlist setState: NSOffState];
673 }
674
675 @end
676
677