Commit 0b3c2052 authored by David Fuhrmann's avatar David Fuhrmann

macosx: add new controller which handles multiple vout windows

refs #6814
parent e0d96420
......@@ -986,6 +986,8 @@
E0382C01160BA09E0031D7FF /* ControlsBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ControlsBar.m; path = ../../../modules/gui/macosx/ControlsBar.m; sourceTree = SOURCE_ROOT; };
E06CF7F416020F6200C698B7 /* Windows.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Windows.h; path = ../../../modules/gui/macosx/Windows.h; sourceTree = SOURCE_ROOT; };
E06CF7F516020F6200C698B7 /* Windows.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Windows.m; path = ../../../modules/gui/macosx/Windows.m; sourceTree = SOURCE_ROOT; };
E0C2583E161B593D00185AAD /* VLCVoutWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLCVoutWindowController.h; path = ../../../modules/gui/macosx/VLCVoutWindowController.h; sourceTree = SOURCE_ROOT; };
E0C2583F161B593D00185AAD /* VLCVoutWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = VLCVoutWindowController.m; path = ../../../modules/gui/macosx/VLCVoutWindowController.m; sourceTree = SOURCE_ROOT; };
E0FB95CD1615B6DF0005069A /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = Resources/English.lproj/DetachedVideoWindow.xib; sourceTree = "<group>"; };
F69B0CA702E24F6401A80112 /* English */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.plist.strings; name = English; path = Resources/English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
/* End PBXFileReference section */
......@@ -1066,6 +1068,8 @@
CC448A6313B68A0B009F72E0 /* MainWindow.m */,
E0382C00160BA09E0031D7FF /* ControlsBar.h */,
E0382C01160BA09E0031D7FF /* ControlsBar.m */,
E0C2583E161B593D00185AAD /* VLCVoutWindowController.h */,
E0C2583F161B593D00185AAD /* VLCVoutWindowController.m */,
CC4A33220F8CB017000FC4A7 /* coredialogs.h */,
CC4A33210F8CB017000FC4A7 /* coredialogs.m */,
5CCED71014C0D4A90057F8D1 /* ExtensionsDialogProvider.h */,
......
......@@ -60,8 +60,6 @@
IBOutlet VLCFSPanel *o_fspanel;
VLCDetachedVideoWindow *o_detached_video_window;
IBOutlet id o_podcast_view;
IBOutlet id o_podcast_add_btn;
IBOutlet id o_podcast_remove_btn;
......@@ -107,7 +105,6 @@
VLCColorView * o_color_backdrop;
NSInteger i_originalLevel;
VLCVideoWindowCommon *o_extra_video_window;
id o_current_video_window;
NSRect frameBeforePlayback;
......
This diff is collapsed.
......@@ -84,4 +84,6 @@ SOURCES_macosx = \
Windows.m \
ControlsBar.m \
ControlsBar.h \
VLCVoutWindowController.m \
VLCVoutWindowController.h \
$(NULL)
/*****************************************************************************
* VLCVoutWindowController.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2012 VLC authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
* David Fuhrmann <david dot fuhrmann at googlemail dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
#import "CompatibilityFixes.h"
#import <vlc_vout_window.h>
@class VLCVideoWindowCommon;
@interface VLCVoutWindowController : NSObject
{
NSMutableDictionary *o_vout_dict;
}
- (void)addVout:(VLCVideoWindowCommon *)o_window forDisplay:(vout_window_t *)p_wnd;
- (void)removeVoutforDisplay:(NSValue *)o_key;
- (void)updateWindowsControlsBarWithSelector:(SEL)aSel;
- (void)updateWindowsUsingBlock:(void (^)(VLCVideoWindowCommon *o_window))windowUpdater;
@end
/*****************************************************************************
* VLCVoutWindowController.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2012 VLC authors and VideoLAN
* $Id$
*
* Authors: Felix Paul Kühne <fkuehne -at- videolan -dot- org>
* David Fuhrmann <david dot fuhrmann at googlemail dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "VLCVoutWindowController.h"
#import "Windows.h"
@implementation VLCVoutWindowController
- (id)init
{
self = [super init];
o_vout_dict = [[NSMutableDictionary alloc] init];
return self;
}
- (void)dealloc
{
[o_vout_dict release];
[super dealloc];
}
- (void)addVout:(VLCVideoWindowCommon *)o_window forDisplay:(vout_window_t *)p_wnd
{
[o_vout_dict setObject:o_window forKey:[NSValue valueWithPointer:p_wnd]];
}
- (void)removeVoutforDisplay:(NSValue *)o_key
{
VLCVideoWindowCommon *o_window = [o_vout_dict objectForKey:o_key];
if (![NSStringFromClass([o_window class]) isEqualToString:@"VLCMainWindow"]) {
[o_window orderOut:self];
}
[o_vout_dict removeObjectForKey:o_key];
}
- (void)updateWindowsControlsBarWithSelector:(SEL)aSel
{
[o_vout_dict enumerateKeysAndObjectsUsingBlock:^(id key, VLCVideoWindowCommon *o_window, BOOL *stop) {
id o_controlsBar = [o_window controlsBar];
if (o_controlsBar)
[o_controlsBar performSelector:aSel];
}];
}
- (void)updateWindowsUsingBlock:(void (^)(VLCVideoWindowCommon *o_window))windowUpdater
{
[o_vout_dict enumerateKeysAndObjectsUsingBlock:^(id key, VLCVideoWindowCommon *o_window, BOOL *stop) {
windowUpdater(o_window);
}];
}
@end
\ No newline at end of file
......@@ -77,6 +77,8 @@ struct intf_sys_t
@class VLCEmbeddedWindow;
@class VLCControls;
@class VLCPlaylist;
@class VLCVoutWindowController;
@interface VLCMain : NSObject <NSWindowDelegate, NSApplicationDelegate>
{
intf_thread_t *p_intf; /* The main intf object */
......@@ -141,8 +143,12 @@ struct intf_sys_t
/* sleep management */
IOPMAssertionID systemSleepAssertionID;
VLCVoutWindowController *o_vout_controller;
}
@property (readonly) VLCVoutWindowController* voutController;
+ (VLCMain *)sharedInstance;
- (intf_thread_t *)intf;
......
......@@ -62,6 +62,7 @@
#import "simple_prefs.h"
#import "CoreInteraction.h"
#import "TrackSynchronization.h"
#import "VLCVoutWindowController.h"
#import <AddressBook/AddressBook.h> /* for crashlog send mechanism */
#import <Sparkle/Sparkle.h> /* we're the update delegate */
......@@ -141,6 +142,7 @@ int WindowOpen(vout_window_t *p_wnd, const vout_window_cfg_t *cfg)
int i_y = cfg->y;
unsigned i_width = cfg->width;
unsigned i_height = cfg->height;
NSLog(@"window open with x%i, y %i, wi %i, hei %i", i_x, i_y, i_width, i_height);
p_wnd->handle.nsobject = [[VLCMain sharedInstance] getVideoViewAtPositionX: &i_x Y: &i_y withWidth: &i_width andHeight: &i_height forWindow: p_wnd];
if (!p_wnd->handle.nsobject) {
......@@ -192,6 +194,8 @@ void WindowClose(vout_window_t *p_wnd)
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
[[VLCMain sharedInstance] setActiveVideoPlayback:NO];
[[[VLCMain sharedInstance] voutController] performSelectorOnMainThread:@selector(removeVoutforDisplay:) withObject:[NSValue valueWithPointer:p_wnd] waitUntilDone:NO];
[o_pool release];
}
......@@ -498,6 +502,8 @@ audio_output_t *getAout(void)
*****************************************************************************/
@implementation VLCMain
@synthesize voutController=o_vout_controller;
#pragma mark -
#pragma mark Initialization
......@@ -540,9 +546,17 @@ static VLCMain *_o_sharedMainInstance = nil;
NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"NO" forKey:@"LiveUpdateTheMessagesPanel"];
[defaults registerDefaults:appDefaults];
o_vout_controller = [[VLCVoutWindowController alloc] init];
return _o_sharedMainInstance;
}
- (void)dealloc
{
[o_vout_controller release];
[super dealloc];
}
- (void)setIntf: (intf_thread_t *)p_mainintf
{
p_intf = p_mainintf;
......
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