Commit 3820b435 authored by Jon Lech Johansen's avatar Jon Lech Johansen

./extras/MacOSX/.../MainMenu.nib: added Open Target panel

  ./modules/gui/macosx/open.[mh]: Open Target code
parent 89987e11
......@@ -24,7 +24,7 @@
};
CLASS = VLCControls;
LANGUAGE = ObjC;
OUTLETS = {o_open = id; };
OUTLETS = {"o_open" = id; };
SUPERCLASS = NSObject;
},
{
......@@ -32,106 +32,119 @@
CLASS = VLCMain;
LANGUAGE = ObjC;
OUTLETS = {
o_controls = id;
o_dmi_pause = id;
o_dmi_play = id;
o_dmi_stop = id;
o_messages = id;
o_mi_about = id;
o_mi_bring_atf = id;
o_mi_chapter = id;
o_mi_clear = id;
o_mi_copy = id;
o_mi_cut = id;
o_mi_deinterlace = id;
o_mi_faster = id;
o_mi_fullscreen = id;
o_mi_hide = id;
o_mi_hide_others = id;
o_mi_language = id;
o_mi_loop = id;
o_mi_messages = id;
o_mi_minimize = id;
o_mi_mute = id;
o_mi_next = id;
o_mi_open_disc = id;
o_mi_open_file = id;
o_mi_open_net = id;
o_mi_open_quickly = id;
o_mi_open_recent = id;
o_mi_open_recent_cm = id;
o_mi_paste = id;
o_mi_pause = id;
o_mi_play = id;
o_mi_playlist = id;
o_mi_previous = id;
o_mi_program = id;
o_mi_quit = id;
o_mi_select_all = id;
o_mi_show_all = id;
o_mi_slower = id;
o_mi_stop = id;
o_mi_subtitle = id;
o_mi_title = id;
o_mi_vol_down = id;
o_mi_vol_up = id;
o_msgs_btn_ok = id;
o_msgs_panel = id;
o_mu_controls = id;
o_mu_edit = id;
o_mu_file = id;
o_mu_view = id;
o_mu_window = id;
o_playlist = id;
o_window = id;
"o_controls" = id;
"o_dmi_pause" = id;
"o_dmi_play" = id;
"o_dmi_stop" = id;
"o_messages" = id;
"o_mi_about" = id;
"o_mi_bring_atf" = id;
"o_mi_chapter" = id;
"o_mi_clear" = id;
"o_mi_copy" = id;
"o_mi_cut" = id;
"o_mi_deinterlace" = id;
"o_mi_faster" = id;
"o_mi_fullscreen" = id;
"o_mi_hide" = id;
"o_mi_hide_others" = id;
"o_mi_language" = id;
"o_mi_loop" = id;
"o_mi_messages" = id;
"o_mi_minimize" = id;
"o_mi_mute" = id;
"o_mi_next" = id;
"o_mi_open_disc" = id;
"o_mi_open_file" = id;
"o_mi_open_net" = id;
"o_mi_open_quickly" = id;
"o_mi_open_recent" = id;
"o_mi_open_recent_cm" = id;
"o_mi_paste" = id;
"o_mi_pause" = id;
"o_mi_play" = id;
"o_mi_playlist" = id;
"o_mi_previous" = id;
"o_mi_program" = id;
"o_mi_quit" = id;
"o_mi_select_all" = id;
"o_mi_show_all" = id;
"o_mi_slower" = id;
"o_mi_stop" = id;
"o_mi_subtitle" = id;
"o_mi_title" = id;
"o_mi_vol_down" = id;
"o_mi_vol_up" = id;
"o_msgs_btn_ok" = id;
"o_msgs_panel" = id;
"o_mu_controls" = id;
"o_mu_edit" = id;
"o_mu_file" = id;
"o_mu_view" = id;
"o_mu_window" = id;
"o_playlist" = id;
"o_window" = id;
};
SUPERCLASS = NSObject;
},
{
ACTIONS = {
openDisc = id;
openDiscStepperChanged = id;
openDiscTypeChanged = id;
openFile = id;
openFileBrowse = id;
openFilePathChanged = id;
openNet = id;
openNetModeChanged = id;
openQuickly = id;
openNetStepperChanged = id;
panelCancel = id;
panelOk = id;
};
CLASS = VLCOpen;
LANGUAGE = ObjC;
OUTLETS = {
o_disc_btn_cancel = id;
o_disc_btn_ok = id;
o_disc_chapter = id;
o_disc_device = id;
o_disc_lbl_sp = id;
o_disc_lbl_type = id;
o_disc_panel = id;
o_disc_title = id;
o_disc_type = id;
o_net_address = id;
o_net_box_addr = id;
o_net_box_mode = id;
o_net_btn_cancel = id;
o_net_btn_ok = id;
o_net_mode = id;
o_net_panel = id;
o_net_port = id;
o_net_port_lbl = id;
o_net_port_stp = id;
o_playlist = id;
o_quickly_btn_cancel = id;
o_quickly_btn_ok = id;
o_quickly_panel = id;
o_quickly_source = id;
"o_btn_cancel" = id;
"o_btn_ok" = id;
"o_disc_chapter" = id;
"o_disc_chapter_lbl" = id;
"o_disc_chapter_stp" = id;
"o_disc_device" = id;
"o_disc_device_lbl" = id;
"o_disc_title" = id;
"o_disc_title_lbl" = id;
"o_disc_title_stp" = id;
"o_disc_type" = id;
"o_disc_type_lbl" = id;
"o_file_btn_browse" = id;
"o_file_path" = id;
"o_mrl" = id;
"o_net_cs_addr" = id;
"o_net_cs_addr_lbl" = id;
"o_net_cs_port" = id;
"o_net_cs_port_lbl" = id;
"o_net_cs_port_stp" = id;
"o_net_http_url" = id;
"o_net_http_url_lbl" = id;
"o_net_mode" = id;
"o_net_udp_port" = id;
"o_net_udp_port_lbl" = id;
"o_net_udp_port_stp" = id;
"o_net_udpm_addr" = id;
"o_net_udpm_addr_lbl" = id;
"o_net_udpm_port" = id;
"o_net_udpm_port_lbl" = id;
"o_net_udpm_port_stp" = id;
"o_panel" = id;
"o_playlist" = id;
"o_tabview" = id;
};
SUPERCLASS = NSObject;
},
{
CLASS = VLCPlaylist;
LANGUAGE = ObjC;
OUTLETS = {o_btn_close = id; o_panel = id; o_table_view = id; };
OUTLETS = {"o_btn_close" = id; "o_panel" = id; "o_table_view" = id; };
SUPERCLASS = NSObject;
},
{CLASS = VLCPlaylistView; LANGUAGE = ObjC; SUPERCLASS = NSTableView; }
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>98 729 428 434 0 0 1600 1178 </string>
......@@ -12,12 +12,12 @@
<string>93 566 72 114 0 0 1600 1178 </string>
</dict>
<key>IBFramework Version</key>
<string>263.2</string>
<string>283.0</string>
<key>IBOpenObjects</key>
<array>
<integer>21</integer>
<integer>636</integer>
</array>
<key>IBSystem Version</key>
<string>5S66</string>
<string>6D52</string>
</dict>
</plist>
......@@ -2,7 +2,7 @@
* open.h: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: open.h,v 1.1 2002/08/04 17:23:43 sam Exp $
* $Id: open.h,v 1.2 2002/10/05 00:10:17 jlj Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
*
......@@ -30,42 +30,61 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class );
{
IBOutlet id o_playlist;
IBOutlet id o_disc_panel;
IBOutlet id o_disc_btn_ok;
IBOutlet id o_disc_btn_cancel;
IBOutlet id o_disc_lbl_type;
IBOutlet id o_disc_lbl_sp;
IBOutlet id o_panel;
IBOutlet id o_mrl;
IBOutlet id o_tabview;
IBOutlet id o_btn_ok;
IBOutlet id o_btn_cancel;
IBOutlet id o_file_path;
IBOutlet id o_file_btn_browse;
IBOutlet id o_disc_type;
IBOutlet id o_disc_type_lbl;
IBOutlet id o_disc_device;
IBOutlet id o_disc_device_lbl;
IBOutlet id o_disc_title;
IBOutlet id o_disc_title_lbl;
IBOutlet id o_disc_title_stp;
IBOutlet id o_disc_chapter;
IBOutlet id o_disc_device;
IBOutlet id o_net_panel;
IBOutlet id o_net_btn_ok;
IBOutlet id o_net_btn_cancel;
IBOutlet id o_net_box_mode;
IBOutlet id o_net_box_addr;
IBOutlet id o_net_mode;
IBOutlet id o_net_address;
IBOutlet id o_net_port;
IBOutlet id o_net_port_lbl;
IBOutlet id o_net_port_stp;
IBOutlet id o_disc_chapter_lbl;
IBOutlet id o_disc_chapter_stp;
IBOutlet id o_quickly_panel;
IBOutlet id o_quickly_btn_ok;
IBOutlet id o_quickly_btn_cancel;
IBOutlet id o_quickly_source;
IBOutlet id o_net_mode;
IBOutlet id o_net_udp_port;
IBOutlet id o_net_udp_port_lbl;
IBOutlet id o_net_udp_port_stp;
IBOutlet id o_net_udpm_addr;
IBOutlet id o_net_udpm_addr_lbl;
IBOutlet id o_net_udpm_port;
IBOutlet id o_net_udpm_port_lbl;
IBOutlet id o_net_udpm_port_stp;
IBOutlet id o_net_cs_addr;
IBOutlet id o_net_cs_addr_lbl;
IBOutlet id o_net_cs_port;
IBOutlet id o_net_cs_port_lbl;
IBOutlet id o_net_cs_port_stp;
IBOutlet id o_net_http_url;
IBOutlet id o_net_http_url_lbl;
}
- (void)openTarget:(int)i_type;
- (void)tabView:(NSTabView *)o_tv didSelectTabViewItem:(NSTabViewItem *)o_tvi;
- (IBAction)openFile:(id)sender;
- (void)openFilePathChanged:(NSNotification *)o_notification;
- (IBAction)openDisc:(id)sender;
- (IBAction)openDiscTypeChanged:(id)sender;
- (IBAction)openDiscStepperChanged:(id)sender;
- (void)openDiscInfoChanged:(NSNotification *)o_notification;
- (IBAction)openNet:(id)sender;
- (IBAction)openNetModeChanged:(id)sender;
- (IBAction)openQuickly:(id)sender;
- (IBAction)openNetStepperChanged:(id)sender;
- (void)openNetInfoChanged:(NSNotification *)o_notification;
- (IBAction)panelCancel:(id)sender;
- (IBAction)panelOk:(id)sender;
......
......@@ -2,7 +2,7 @@
* open.m: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: open.m,v 1.2 2002/08/06 23:43:58 jlj Exp $
* $Id: open.m,v 1.3 2002/10/05 00:10:17 jlj Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
*
......@@ -134,51 +134,136 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
- (void)awakeFromNib
{
[o_disc_panel setTitle: _NS("Open Disc")];
[o_disc_btn_ok setTitle: _NS("OK")];
[o_disc_btn_cancel setTitle: _NS("Cancel")];
[o_disc_lbl_type setTitle: _NS("Disc type")];
[o_disc_lbl_sp setTitle: _NS("Starting position")];
[o_disc_title setTitle: _NS("Title")];
[o_disc_chapter setTitle: _NS("Chapter")];
[o_net_panel setTitle: _NS("Open Network")];
[o_net_box_mode setTitle: _NS("Network mode")];
[o_net_box_addr setTitle: _NS("Address")];
[o_net_port_lbl setStringValue: _NS("Port")];
[o_quickly_panel setTitle: _NS("Open Quickly")];
[o_quickly_btn_ok setTitle: _NS("OK")];
[o_quickly_btn_cancel setTitle: _NS("Cancel")];
[o_panel setTitle: _NS("Open Target")];
[o_btn_ok setTitle: _NS("OK")];
[o_btn_cancel setTitle: _NS("Cancel")];
[[o_tabview tabViewItemAtIndex: 0] setLabel: _NS("File")];
[[o_tabview tabViewItemAtIndex: 1] setLabel: _NS("Disc")];
[[o_tabview tabViewItemAtIndex: 2] setLabel: _NS("Network")];
[o_file_btn_browse setTitle: _NS("Browse...")];
[o_disc_type_lbl setStringValue: _NS("Disc type")];
[o_disc_device_lbl setStringValue: _NS("Device name")];
[o_disc_title_lbl setStringValue: _NS("Title")];
[o_disc_chapter_lbl setStringValue: _NS("Chapter")];
[o_net_udp_port_lbl setStringValue: _NS("Port")];
[o_net_udpm_addr_lbl setStringValue: _NS("Address")];
[o_net_udpm_port_lbl setStringValue: _NS("Port")];
[o_net_cs_addr_lbl setStringValue: _NS("Address")];
[o_net_cs_port_lbl setStringValue: _NS("Port")];
[o_net_http_url_lbl setStringValue: _NS("URL")];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openFilePathChanged:)
name: NSControlTextDidChangeNotification
object: o_file_path];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openDiscInfoChanged:)
name: NSControlTextDidChangeNotification
object: o_disc_device];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openDiscInfoChanged:)
name: NSControlTextDidChangeNotification
object: o_disc_title];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openDiscInfoChanged:)
name: NSControlTextDidChangeNotification
object: o_disc_chapter];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openNetInfoChanged:)
name: NSControlTextDidChangeNotification
object: o_net_udp_port];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openNetInfoChanged:)
name: NSControlTextDidChangeNotification
object: o_net_udpm_addr];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openNetInfoChanged:)
name: NSControlTextDidChangeNotification
object: o_net_udpm_port];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openNetInfoChanged:)
name: NSControlTextDidChangeNotification
object: o_net_cs_addr];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openNetInfoChanged:)
name: NSControlTextDidChangeNotification
object: o_net_cs_port];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(openNetInfoChanged:)
name: NSControlTextDidChangeNotification
object: o_net_http_url];
}
- (IBAction)openDisc:(id)sender
- (void)openTarget:(int)i_type
{
int i_result;
[self openDiscTypeChanged: nil];
[o_disc_panel makeKeyAndOrderFront: self];
i_result = [NSApp runModalForWindow: o_disc_panel];
[o_disc_panel close];
[o_tabview selectTabViewItemAtIndex: i_type];
i_result = [NSApp runModalForWindow: o_panel];
[o_panel close];
if( i_result )
{
NSString *o_source;
NSString *o_type = [[o_disc_type selectedCell] title];
NSString *o_device = [o_disc_device stringValue];
int i_title = [o_disc_title intValue];
int i_chapter = [o_disc_chapter intValue];
o_source = [NSString stringWithFormat: @"%@:%@@%d,%d",
[o_type lowercaseString], o_device, i_title, i_chapter];
NSString *o_source = [o_mrl stringValue];
[o_playlist appendArray:
[NSArray arrayWithObject: o_source] atPos: -1];
}
}
- (void)tabView:(NSTabView *)o_tv didSelectTabViewItem:(NSTabViewItem *)o_tvi
{
NSString *o_label = [o_tvi label];
if( [o_label isEqualToString: _NS("File")] )
{
[self openFilePathChanged: nil];
}
else if( [o_label isEqualToString: _NS("Disc")] )
{
[self openDiscTypeChanged: nil];
}
else if( [o_label isEqualToString: _NS("Network")] )
{
[self openNetModeChanged: nil];
}
}
- (IBAction)openFile:(id)sender
{
[self openFilePathChanged: nil];
[self openTarget: 0];
}
- (IBAction)openDisc:(id)sender
{
[self openDiscTypeChanged: nil];
[self openTarget: 1];
}
- (IBAction)openNet:(id)sender
{
[self openNetModeChanged: nil];
[self openTarget: 2];
}
- (void)openFilePathChanged:(NSNotification *)o_notification
{
NSString *o_mrl_string;
NSString *o_filename = [o_file_path stringValue];
o_mrl_string = [NSString stringWithFormat: @"file://%@", o_filename];
[o_mrl setStringValue: o_mrl_string];
}
- (IBAction)openDiscTypeChanged:(id)sender
{
NSString *o_type;
......@@ -214,158 +299,177 @@ NSArray *GetEjectableMediaOfClass( const char *psz_class )
}
[o_disc_device selectItemAtIndex: 0];
[o_disc_btn_ok setEnabled: TRUE];
}
else
{
[o_disc_device setStringValue:
[NSString stringWithFormat: @"No %@s found", o_type]];
[o_disc_btn_ok setEnabled: FALSE];
}
}
[self openDiscInfoChanged: nil];
}
- (IBAction)openFile:(id)sender
- (IBAction)openDiscStepperChanged:(id)sender
{
NSOpenPanel *o_panel = [NSOpenPanel openPanel];
[o_panel setAllowsMultipleSelection: YES];
int i_tag = [sender tag];
if( [o_panel runModalForDirectory: nil
file: nil types: nil] == NSOKButton )
if( i_tag == 0 )
{
[o_playlist appendArray: [o_panel filenames] atPos: -1];
[o_disc_title setIntValue: [o_disc_title_stp intValue]];
}
}
- (IBAction)openNet:(id)sender
{
int i_result;
intf_thread_t * p_intf = [NSApp getIntf];
[o_net_panel makeKeyAndOrderFront: self];
i_result = [NSApp runModalForWindow: o_net_panel];
[o_net_panel close];
if( i_result )
else if( i_tag == 1 )
{
NSString * o_source = nil;
UInt32 i_port = [o_net_port intValue];
NSString * o_addr = [o_net_address stringValue];
NSString * o_mode = [[o_net_mode selectedCell] title];
if( i_port > 65536 )
{
NSBeep();
return;
}
[o_disc_chapter setIntValue: [o_disc_chapter_stp intValue]];
}
if( [o_mode isEqualToString: @"UDP"] )
{
o_source = [NSString
stringWithFormat: @"udp:@:%i", i_port];
}
else if( [o_mode isEqualToString: @"UDP Multicase"] )
{
o_source = [NSString
stringWithFormat: @"udp:@%@:%i", o_addr, i_port];
}
else if( [o_mode isEqualToString: @"Channel server"] )
{
if( p_intf->p_vlc->p_channel == NULL )
{
network_ChannelCreate( p_intf );
}
[self openDiscInfoChanged: nil];
}
config_PutPsz( p_intf, "channel-server",
(char *)[o_addr lossyCString] );
config_PutInt( p_intf, "channel-port", i_port );
- (void)openDiscInfoChanged:(NSNotification *)o_notification
{
NSString *o_type;
NSString *o_device;
NSString *o_mrl_string;
int i_title, i_chapter;
p_intf->p_sys->b_playing = 1;
}
else if( [o_mode isEqualToString: @"HTTP"] )
{
o_source = o_addr;
}
o_type = [[o_disc_type selectedCell] title];
o_device = [o_disc_device stringValue];
i_title = [o_disc_title intValue];
i_chapter = [o_disc_chapter intValue];
o_mrl_string = [NSString stringWithFormat: @"%@://%@@%i,%i",
[o_type lowercaseString], o_device, i_title, i_chapter];
if( o_source != nil )
{
[o_playlist appendArray:
[NSArray arrayWithObject: o_source] atPos: -1];
}
}
[o_mrl setStringValue: o_mrl_string];
}
- (IBAction)openNetModeChanged:(id)sender
{
NSString * o_mode;
SInt32 i_port = 1234;
NSString * o_addr = nil;
NSString *o_mode;
BOOL b_udp = FALSE;
BOOL b_udpm = FALSE;
BOOL b_cs = FALSE;
BOOL b_http = FALSE;
o_mode = [[o_net_mode selectedCell] title];
if( [o_mode isEqualToString: @"UDP Multicast"] )
if( [o_mode isEqualToString: @"UDP"] ) b_udp = TRUE;
else if( [o_mode isEqualToString: @"UDP Multicast"] ) b_udpm = TRUE;
else if( [o_mode isEqualToString: @"Channel server"] ) b_cs = TRUE;
else if( [o_mode isEqualToString: @"HTTP"] ) b_http = TRUE;
[o_net_udp_port setEnabled: b_udp];
[o_net_udp_port_stp setEnabled: b_udp];
[o_net_udpm_addr setEnabled: b_udpm];
[o_net_udpm_port setEnabled: b_udpm];
[o_net_udpm_port_stp setEnabled: b_udpm];
[o_net_cs_addr setEnabled: b_cs];
[o_net_cs_port setEnabled: b_cs