Commit 2d47c8c0 authored by David Fuhrmann's avatar David Fuhrmann

macosx: Convert VLCOpen to NSWindowController subclass

parent 3a07082a
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8152.3" systemVersion="14F6a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7706" systemVersion="14F19a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment version="1070" identifier="macosx"/>
<development version="5100" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8152.3"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7706"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="VLCOpen">
......@@ -126,7 +126,6 @@
<outlet property="okButton" destination="640" id="S9F-WP-A7y"/>
<outlet property="outputCheckbox" destination="929" id="Gz1-rY-w0Q"/>
<outlet property="outputSettingsButton" destination="1256" id="ruY-7h-HIS"/>
<outlet property="panel" destination="636" id="POG-Xe-8j5"/>
<outlet property="qtkAudioCheckbox" destination="3492" id="5d3-k7-1dB"/>
<outlet property="qtkAudioDevicePopup" destination="3438" id="Jt3-3n-AjR"/>
<outlet property="qtkHeightLabel" destination="3349" id="1V9-Wm-BdJ"/>
......@@ -160,6 +159,7 @@
<outlet property="screenqtkAudioCheckbox" destination="3515" id="Y4X-ro-aSB"/>
<outlet property="screenqtkAudioPopup" destination="3506" id="gkb-yW-rOf"/>
<outlet property="tabView" destination="678" id="bM9-Bh-adI"/>
<outlet property="window" destination="636" id="cOB-1N-Yl8"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
......
......@@ -140,7 +140,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
int items_at_launch;
BOOL nib_main_loaded; /* main nibfile */
BOOL nib_open_loaded; /* open nibfile */
BOOL nib_about_loaded; /* about nibfile */
BOOL nib_prefs_loaded; /* preferences xibfile */
BOOL nib_sprefs_loaded; /* simple preferences xibfile */
......@@ -223,7 +222,6 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification
{
_open = [[VLCOpen alloc] init];
_coreinteraction = [VLCCoreInteraction sharedInstance];
playlist_t * p_playlist = pl_Get(VLCIntf);
......@@ -540,8 +538,8 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
- (VLCOpen *)open
{
if (!nib_open_loaded)
nib_open_loaded = [NSBundle loadNibNamed:@"Open" owner: _open];
if (!_open)
_open = [[VLCOpen alloc] init];
return _open;
}
......
......@@ -24,9 +24,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
@interface VLCOpen : NSObject
@property (readwrite, weak) IBOutlet NSWindow *panel;
@interface VLCOpen : NSWindowController
@property (readwrite, weak) IBOutlet NSTextField *mrlTextField;
@property (readwrite, weak) IBOutlet NSTextField *mrlLabel;
......
......@@ -84,6 +84,14 @@ struct display_info_t
#pragma mark -
#pragma mark Init
- (id)init
{
self = [super initWithWindowNibName:@"Open"];
return self;
}
- (void)dealloc
{
for (int i = 0; i < [_displayInfos count]; i ++) {
......@@ -92,13 +100,13 @@ struct display_info_t
}
}
- (void)awakeFromNib
- (void)windowDidLoad
{
_output = [VLCOutput new];
[_panel setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
[self.window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
[_panel setTitle: _NS("Open Source")];
[self.window setTitle: _NS("Open Source")];
[_mrlLabel setStringValue: _NS("Media Resource Locator (MRL)")];
[_okButton setTitle: _NS("Open")];
......@@ -391,14 +399,17 @@ struct display_info_t
if ([NSApp modalWindow] != nil)
return;
// load window
[self window];
_eyeTVController = [[VLCEyeTVController alloc] init];
int i_result;
[_tabView selectTabViewItemAtIndex: i_type];
[_fileSubCheckbox setState: NSOffState];
i_result = [NSApp runModalForWindow: _panel];
[_panel close];
i_result = [NSApp runModalForWindow: self.window];
[self.window close];
if (i_result) {
NSMutableDictionary *itemOptionsDictionary;
......@@ -568,7 +579,7 @@ struct display_info_t
- (IBAction)expandMRLfieldAction:(id)sender
{
NSRect windowRect = [_panel frame];
NSRect windowRect = [self.window frame];
NSRect viewRect = [_mrlView frame];
if ([_mrlButton state] == NSOffState) {
......@@ -591,10 +602,10 @@ struct display_info_t
windowRect.size.height = windowRect.size.height + viewRect.size.height;
}
[[_panel animator] setFrame: windowRect display:YES];
[[self.window animator] setFrame: windowRect display:YES];
if ([_mrlButton state] == NSOnState)
[[_panel contentView] addSubview: _mrlView];
[[self.window contentView] addSubview: _mrlView];
}
- (void)openFileGeneric
......@@ -669,7 +680,7 @@ struct display_info_t
b_outputNibLoaded = [NSBundle loadNibNamed:@"StreamOutput" owner:_output];
[NSApp beginSheet:_output.outputSheet
modalForWindow:self.panel
modalForWindow:self.window
modalDelegate:self
didEndSelector:NULL
contextInfo:nil];
......@@ -1023,9 +1034,9 @@ struct display_info_t
{
if (sender == _netModeMatrix) {
if ([[sender selectedCell] tag] == 0)
[_panel makeFirstResponder: _netUDPPortTextField];
[self.window makeFirstResponder: _netUDPPortTextField];
else if ([[sender selectedCell] tag] == 1)
[_panel makeFirstResponder: _netUDPMAddressTextField];
[self.window makeFirstResponder: _netUDPMAddressTextField];
else
msg_Warn(VLCIntf, "Unknown sender tried to change UDP/RTP mode");
}
......@@ -1041,13 +1052,13 @@ struct display_info_t
[_netUDPPortTextField setIntValue: [_netUDPPortStepper intValue]];
[[NSNotificationCenter defaultCenter] postNotificationName: VLCOpenTextFieldWasClicked
object: _netUDPPortTextField];
[_panel makeFirstResponder: _netUDPPortTextField];
[self.window makeFirstResponder: _netUDPPortTextField];
}
else if (i_tag == 1) {
[_netUDPMPortTextField setIntValue: [_netUDPMPortStepper intValue]];
[[NSNotificationCenter defaultCenter] postNotificationName: VLCOpenTextFieldWasClicked
object: _netUDPMPortTextField];
[_panel makeFirstResponder: _netUDPMPortTextField];
[self.window makeFirstResponder: _netUDPMPortTextField];
}
[self openNetInfoChanged: nil];
......@@ -1098,7 +1109,7 @@ struct display_info_t
{
if (sender == _netOpenUDPButton) {
[NSApp beginSheet: self.netUDPPanel
modalForWindow: self.panel
modalForWindow: self.window
modalDelegate: self
didEndSelector: NULL
contextInfo: nil];
......
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