Commit 42701994 authored by hartman's avatar hartman

* Brought the new options system to the OSX gui.

  and some small fixes.
parent 802b24bc
...@@ -242,8 +242,10 @@ ...@@ -242,8 +242,10 @@
"o_net_udpm_port" = id; "o_net_udpm_port" = id;
"o_net_udpm_port_lbl" = id; "o_net_udpm_port_lbl" = id;
"o_net_udpm_port_stp" = id; "o_net_udpm_port_stp" = id;
"o_output_ckbox" = id;
"o_panel" = id; "o_panel" = id;
"o_playlist" = id; "o_playlist" = id;
"o_sout_options" = id;
"o_tabview" = id; "o_tabview" = id;
}; };
SUPERCLASS = NSObject; SUPERCLASS = NSObject;
......
...@@ -21,6 +21,10 @@ ...@@ -21,6 +21,10 @@
<array> <array>
<integer>977</integer> <integer>977</integer>
</array> </array>
<key>IBOpenObjects</key>
<array>
<integer>636</integer>
</array>
<key>IBSystem Version</key> <key>IBSystem Version</key>
<string>6L60</string> <string>6L60</string>
</dict> </dict>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf.m: MacOS X interface plugin * intf.m: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * Copyright (C) 2002-2003 VideoLAN
* $Id: intf.m,v 1.92 2003/07/27 14:10:02 massiot Exp $ * $Id: intf.m,v 1.93 2003/07/27 23:05:41 hartman Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -465,15 +465,9 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable, ...@@ -465,15 +465,9 @@ int PlaylistChanged( vlc_object_t *p_this, const char *psz_variable,
- (BOOL)application:(NSApplication *)o_app openFile:(NSString *)o_filename - (BOOL)application:(NSApplication *)o_app openFile:(NSString *)o_filename
{ {
intf_thread_t * p_intf = [NSApp getIntf]; NSDictionary *o_dic = [NSDictionary dictionaryWithObjectsAndKeys: o_filename, @"ITEM_URL", nil];
config_PutPsz( p_intf, "sub-file", "" );
config_PutInt( p_intf, "sub-delay", 0 );
config_PutFloat( p_intf, "sub-fps", 0.0 );
config_PutPsz( p_intf, "sout", "" );
[o_playlist appendArray: [o_playlist appendArray:
[NSArray arrayWithObject: o_filename] atPos: -1 enqueue: NO]; [NSArray arrayWithObject: o_dic] atPos: -1 enqueue: NO];
return( TRUE ); return( TRUE );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* open.h: MacOS X plugin for vlc * open.h: MacOS X plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * Copyright (C) 2002-2003 VideoLAN
* $Id: open.h,v 1.14 2003/04/30 23:58:56 hartman Exp $ * $Id: open.h,v 1.15 2003/07/27 23:05:41 hartman Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -84,6 +84,9 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class ); ...@@ -84,6 +84,9 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class );
IBOutlet id o_file_sub_fps_lbl; IBOutlet id o_file_sub_fps_lbl;
IBOutlet id o_file_sub_fps_stp; IBOutlet id o_file_sub_fps_stp;
IBOutlet id o_file_sub_ok_btn; IBOutlet id o_file_sub_ok_btn;
IBOutlet id o_output_ckbox;
IBOutlet id o_sout_options;
} }
- (void)openTarget:(int)i_type; - (void)openTarget:(int)i_type;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* open.m: MacOS X plugin for vlc * open.m: MacOS X plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * Copyright (C) 2002-2003 VideoLAN
* $Id: open.m,v 1.35 2003/05/25 17:27:13 massiot Exp $ * $Id: open.m,v 1.36 2003/07/27 23:05:41 hartman Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "intf.h" #include "intf.h"
#include "playlist.h" #include "playlist.h"
#include "open.h" #include "open.h"
#include "output.h"
/***************************************************************************** /*****************************************************************************
* GetEjectableMediaOfClass * GetEjectableMediaOfClass
...@@ -232,28 +233,26 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class ) ...@@ -232,28 +233,26 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = [NSApp getIntf];
NSString *o_source = [o_mrl stringValue]; NSMutableDictionary *o_dic;
NSMutableArray *o_options = [NSMutableArray array];
BOOL b_enq = [o_ckbox_enqueue state] == NSOnState ? YES : NO; BOOL b_enq = [o_ckbox_enqueue state] == NSOnState ? YES : NO;
NSString *subPath = [o_file_sub_path stringValue]; o_dic = [NSMutableDictionary dictionaryWithObject: [o_mrl stringValue] forKey: @"ITEM_URL"];
if (([o_file_sub_ckbox state] == NSOnState) && !([subPath isEqualTo: @""])) if( [o_file_sub_ckbox state] == NSOnState )
{ {
config_PutPsz( p_intf, "sub-file", strdup( [subPath UTF8String] ) ); [o_options addObject: [NSString stringWithFormat: @"sub-file=%s", [[o_file_sub_path stringValue] UTF8String]]];
if ( [o_file_sub_override state] ) if( [o_file_sub_override state] == NSOnState )
{ {
config_PutInt( p_intf, "sub-delay", (int)( [o_file_sub_delay intValue] * 10 ) ); [o_options addObject: [NSString stringWithFormat: @"sub-delay=%i", (int)( [o_file_sub_delay intValue] * 10 )]];
config_PutFloat( p_intf, "sub-fps", [o_file_sub_fps floatValue] ); [o_options addObject: [NSString stringWithFormat: @"sub-fps=%f", [o_file_sub_fps floatValue]]];
} }
} }
else if( [o_output_ckbox state] == NSOnState )
{ {
config_PutPsz( p_intf, "sub-file", "" ); [o_options addObject: [NSString stringWithFormat: @"sout=%@", [(VLCOutput *)o_sout_options getMRL]]];
config_PutInt( p_intf, "sub-delay", 0 );
config_PutFloat( p_intf, "sub-fps", 0.0 );
} }
[o_dic setObject: (NSArray *)[o_options copy] forKey: @"ITEM_OPTIONS"];
[o_playlist appendArray: [o_playlist appendArray: [NSArray arrayWithObject: o_dic] atPos: -1 enqueue:b_enq];
[NSArray arrayWithObject: o_source] atPos: -1 enqueue:b_enq];
} }
} }
...@@ -624,6 +623,7 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class ) ...@@ -624,6 +623,7 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
- (IBAction)openFile:(id)sender - (IBAction)openFile:(id)sender
{ {
NSOpenPanel *o_open_panel = [NSOpenPanel openPanel]; NSOpenPanel *o_open_panel = [NSOpenPanel openPanel];
int i;
[o_open_panel setAllowsMultipleSelection: YES]; [o_open_panel setAllowsMultipleSelection: YES];
[o_open_panel setCanChooseDirectories: YES]; [o_open_panel setCanChooseDirectories: YES];
...@@ -633,18 +633,17 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class ) ...@@ -633,18 +633,17 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
if( [o_open_panel runModalForDirectory: nil if( [o_open_panel runModalForDirectory: nil
file: nil types: nil] == NSOKButton ) file: nil types: nil] == NSOKButton )
{ {
intf_thread_t * p_intf = [NSApp getIntf]; NSArray *o_array = [NSArray array];
config_PutPsz( p_intf, "sout", NULL );
NSArray *o_values = [[o_open_panel filenames] NSArray *o_values = [[o_open_panel filenames]
sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
config_PutPsz( p_intf, "sub-file", "" ); for( i = 0; i < [o_values count]; i++)
config_PutInt( p_intf, "sub-delay", 0 ); {
config_PutFloat( p_intf, "sub-fps", 0.0 ); NSDictionary *o_dic;
config_PutPsz( p_intf, "sout", "" ); o_dic = [NSDictionary dictionaryWithObject:[o_values objectAtIndex:i] forKey:@"ITEM_URL"];
o_array = [o_array arrayByAddingObject: o_dic];
[o_playlist appendArray: o_values atPos: -1 enqueue:NO]; }
[o_playlist appendArray: o_array atPos: -1 enqueue:NO];
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* output.h: MacOS X Output Dialog * output.h: MacOS X Output Dialog
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * Copyright (C) 2002-2003 VideoLAN
* $Id: output.h,v 1.2 2003/07/20 19:48:30 hartman Exp $ * $Id: output.h,v 1.3 2003/07/27 23:05:41 hartman Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
} }
- (void)setMRL:(NSString *)o_mrl_string; - (void)setMRL:(NSString *)o_mrl_string;
- (NSString *)getMRL;
- (void)setTranscode:(NSString *)o_transcode_string; - (void)setTranscode:(NSString *)o_transcode_string;
- (void)initStrings; - (void)initStrings;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* output.m: MacOS X Output Dialog * output.m: MacOS X Output Dialog
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * Copyright (C) 2002-2003 VideoLAN
* $Id: output.m,v 1.10 2003/07/20 19:48:30 hartman Exp $ * $Id: output.m,v 1.11 2003/07/27 23:05:41 hartman Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Christophe Massiot <massiot@via.ecp.fr> * Christophe Massiot <massiot@via.ecp.fr>
...@@ -58,6 +58,11 @@ ...@@ -58,6 +58,11 @@
o_mrl = [o_mrl_string copy]; o_mrl = [o_mrl_string copy];
} }
- (NSString *)getMRL
{
return [o_mrl copy];
}
- (void)setTranscode:(NSString *)o_transcode_string - (void)setTranscode:(NSString *)o_transcode_string
{ {
[o_transcode autorelease]; [o_transcode autorelease];
...@@ -66,19 +71,6 @@ ...@@ -66,19 +71,6 @@
- (void)awakeFromNib - (void)awakeFromNib
{ {
intf_thread_t * p_intf = [NSApp getIntf];
char * psz_sout = config_GetPsz( p_intf, "sout" );
if ( psz_sout != NULL && *psz_sout )
{
[o_output_ckbox setState: YES];
}
else
{
[o_output_ckbox setState: NO];
}
free(psz_sout);
[self initStrings]; [self initStrings];
[[NSNotificationCenter defaultCenter] addObserver: self [[NSNotificationCenter defaultCenter] addObserver: self
...@@ -183,8 +175,6 @@ ...@@ -183,8 +175,6 @@
} }
else else
{ {
intf_thread_t * p_intf = [NSApp getIntf];
config_PutPsz( p_intf, "sout", NULL );
[o_output_settings setEnabled:NO]; [o_output_settings setEnabled:NO];
} }
} }
...@@ -201,7 +191,7 @@ ...@@ -201,7 +191,7 @@
- (IBAction)outputCloseSheet:(id)sender - (IBAction)outputCloseSheet:(id)sender
{ {
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = [NSApp getIntf];
config_PutPsz( p_intf, "sout", [o_mrl UTF8String] ); //export sout[o_mrl UTF8String]
[o_output_sheet orderOut:sender]; [o_output_sheet orderOut:sender];
[NSApp endSheet: o_output_sheet]; [NSApp endSheet: o_output_sheet];
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.h: MacOS X interface plugin * playlist.h: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * Copyright (C) 2002-2003 VideoLAN
* $Id: playlist.h,v 1.9 2003/03/26 00:21:55 sam Exp $ * $Id: playlist.h,v 1.10 2003/07/27 23:05:41 hartman Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <thedj@users.sourceforge.net> * Derk-Jan Hartman <thedj@users.sourceforge.net>
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
- (IBAction)deleteItems:(id)sender; - (IBAction)deleteItems:(id)sender;
- (IBAction)selectAll:(id)sender; - (IBAction)selectAll:(id)sender;
- (void)appendArray:(NSArray*)o_array atPos:(int)i_pos enqueue:(BOOL)b_enqueue; - (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue;
- (void)updateRowSelection; - (void)updateRowSelection;
- (void)playlistUpdated; - (void)playlistUpdated;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* playlist.m: MacOS X interface plugin * playlist.m: MacOS X interface plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2002-2003 VideoLAN * Copyright (C) 2002-2003 VideoLAN
* $Id: playlist.m,v 1.28 2003/07/23 01:13:47 gbazin Exp $ * $Id: playlist.m,v 1.29 2003/07/27 23:05:41 hartman Exp $
* *
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net> * Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
* Derk-Jan Hartman <thedj@users.sourceforge.net> * Derk-Jan Hartman <thedj@users.sourceforge.net>
...@@ -286,11 +286,9 @@ int MacVersion102 = -1; ...@@ -286,11 +286,9 @@ int MacVersion102 = -1;
[o_table_view selectAll: nil]; [o_table_view selectAll: nil];
} }
- (void)appendArray:(NSArray*)o_array atPos:(int)i_pos enqueue:(BOOL)b_enqueue - (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue
{ {
int i_items; int i_item;
NSString * o_value;
NSEnumerator * o_enum;
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = [NSApp getIntf];
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
...@@ -300,28 +298,58 @@ int MacVersion102 = -1; ...@@ -300,28 +298,58 @@ int MacVersion102 = -1;
return; return;
} }
i_items = 0; for ( i_item = 0; i_item < [o_array count]; i_item++ )
o_enum = [o_array objectEnumerator];
while( ( o_value = [o_enum nextObject] ) )
{ {
NSURL * o_url; /* One item */
NSDictionary *o_one_item;
NSString *o_url;
NSString *o_name;
NSArray *o_options;
int j, i_total_options = 0;
char **ppsz_options = NULL;
int i_mode = PLAYLIST_INSERT; int i_mode = PLAYLIST_INSERT;
if (i_items == 0 && !b_enqueue) /* Get the item */
o_one_item = [o_array objectAtIndex: i_item];
o_url = (NSString *)[o_one_item objectForKey: @"ITEM_URL"];
o_name = (NSString *)[o_one_item objectForKey: @"ITEM_NAME"];
o_options = (NSArray *)[o_one_item objectForKey: @"ITEM_OPTIONS"];
if( !o_name) o_name = o_url;
if (i_item == 0 && !b_enqueue)
i_mode |= PLAYLIST_GO; i_mode |= PLAYLIST_GO;
playlist_Add( p_playlist, [o_value fileSystemRepresentation], if( o_options && [o_options count] > 0 )
0, 0, i_mode, i_pos == -1 ? PLAYLIST_END : i_pos + i_items ); {
/* Count the input options */
i_total_options = [o_options count];
/* Allocate ppsz_options */
for( j = 0; j < i_total_options; j++ )
{
if( !ppsz_options )
ppsz_options = (char **)malloc( sizeof(char *) * i_total_options );
ppsz_options[j] = strdup([[o_options objectAtIndex:j] UTF8String]);
}
}
playlist_AddName( p_playlist, [o_url fileSystemRepresentation], [o_name UTF8String],
(ppsz_options != NULL ) ? (const char **)ppsz_options : 0, i_total_options,
i_mode, i_position == -1 ? PLAYLIST_END : i_position + i_item );
o_url = [NSURL fileURLWithPath: o_value]; /* clean up */
if( o_url != nil ) for( j = 0; j < i_total_options; j++ )
free( ppsz_options[j] );
if( ppsz_options ) free( ppsz_options );
NSURL *o_true_url = [NSURL fileURLWithPath: o_url];
if( o_true_url != nil )
{ {
[[NSDocumentController sharedDocumentController] [[NSDocumentController sharedDocumentController]
noteNewRecentDocumentURL: o_url]; noteNewRecentDocumentURL: o_true_url];
} }
i_items++;
} }
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
...@@ -468,7 +496,6 @@ int MacVersion102 = -1; ...@@ -468,7 +496,6 @@ int MacVersion102 = -1;
} }
else else
{ {
NSArray * o_values;
NSPasteboard * o_pasteboard; NSPasteboard * o_pasteboard;
intf_thread_t * p_intf = [NSApp getIntf]; intf_thread_t * p_intf = [NSApp getIntf];
...@@ -476,15 +503,18 @@ int MacVersion102 = -1; ...@@ -476,15 +503,18 @@ int MacVersion102 = -1;
if( [[o_pasteboard types] containsObject: NSFilenamesPboardType] ) if( [[o_pasteboard types] containsObject: NSFilenamesPboardType] )
{ {
o_values = [[o_pasteboard propertyListForType: NSFilenamesPboardType] int i;
NSArray *o_array = [NSArray array];
NSArray *o_values = [[o_pasteboard propertyListForType: NSFilenamesPboardType]
sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
config_PutPsz( p_intf, "sub-file", "" ); for( i = 0; i < [o_values count]; i++)
config_PutInt( p_intf, "sub-delay", 0 ); {
config_PutFloat( p_intf, "sub-fps", 0.0 ); NSDictionary *o_dic;
config_PutPsz( p_intf, "sout", "" ); o_dic = [NSDictionary dictionaryWithObject:[o_values objectAtIndex:i] forKey:@"ITEM_URL"];
o_array = [o_array arrayByAddingObject: o_dic];
[self appendArray: o_values atPos: i_proposed_row enqueue:YES]; }
[self appendArray: o_array atPos: i_proposed_row enqueue:YES];
return( YES ); return( YES );
} }
......
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