Commit 7b66b72d authored by David Fuhrmann's avatar David Fuhrmann

macosx: Convert VLCVideoEffects to NSWindowController subclass

parent f6c4ab14
......@@ -53,13 +53,11 @@
@interface VLCMainMenu()
{
BOOL b_nib_videoeffects_loaded;
BOOL b_nib_bookmarks_loaded;
BOOL b_nib_convertandsave_loaded;
AboutWindowController *_aboutWindowController;
HelpWindowController *_helpWindowController;
VLCVideoEffects *_videoEffectsWindowController;
VLCConvertAndSave *_convertAndSaveWindowController;
AddonsWindowController *_addonsController;
......@@ -1279,13 +1277,7 @@
- (IBAction)showVideoEffects:(id)sender
{
if (_videoEffectsWindowController == nil)
_videoEffectsWindowController = [[VLCVideoEffects alloc] init];
if (!b_nib_videoeffects_loaded)
b_nib_videoeffects_loaded = [NSBundle loadNibNamed:@"VideoEffects" owner: _videoEffectsWindowController];
[_videoEffectsWindowController toggleWindow:sender];
[[[VLCMain sharedInstance] videoEffectsPanel] toggleWindow:sender];
}
- (IBAction)showTrackSynchronization:(id)sender
......
......@@ -589,7 +589,7 @@ void WindowClose(vout_window_t *p_wnd)
VLCMain *main = [VLCMain sharedInstance];
[[VLCMainWindow sharedInstance] setWindowLevel:i_level];
[[VLCVideoEffects sharedInstance] updateCocoaWindowLevel:currentStatusWindowLevel];
[[main videoEffectsPanel] updateCocoaWindowLevel:currentStatusWindowLevel];
[[main audioEffectsPanel] updateCocoaWindowLevel:currentStatusWindowLevel];
[[VLCInfo sharedInstance] updateCocoaWindowLevel:currentStatusWindowLevel];
[[main bookmarks] updateCocoaWindowLevel:currentStatusWindowLevel];
......
......@@ -23,10 +23,9 @@
#import <Cocoa/Cocoa.h>
@interface VLCVideoEffects : NSObject
@interface VLCVideoEffects : NSWindowController
/* generic */
@property (readwrite, weak) IBOutlet NSWindow *window;
@property (readwrite, weak) IBOutlet NSTabView *tabView;
@property (readwrite, weak) IBOutlet NSPopUpButton *profilePopup;
......@@ -162,7 +161,6 @@
@property (nonatomic) int posterizeValue;
/* generic */
+ (VLCVideoEffects *)sharedInstance;
- (void)updateCocoaWindowLevel:(NSInteger)i_level;
- (void)saveCurrentProfile;
......
......@@ -38,18 +38,6 @@
@implementation VLCVideoEffects
+ (VLCVideoEffects *)sharedInstance
{
static VLCVideoEffects *sharedInstance = nil;
static dispatch_once_t pred;
dispatch_once(&pred, ^{
sharedInstance = [VLCVideoEffects new];
});
return sharedInstance;
}
+ (void)initialize
{
NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:[NSArray arrayWithObject:@";;;0;1.000000;1.000000;1.000000;1.000000;0.050000;16;2.000000;OTA=;4;4;16711680;20;15;120;Z3JhZGllbnQ=;1;0;16711680;6;80;VkxD;-1;;-1;255;2;3;3"], @"VideoEffectProfiles",
......@@ -59,17 +47,19 @@
- (id)init
{
self = [super init];
self = [super initWithWindowNibName:@"VideoEffects"];
if (self) {
i_old_profile_index = -1;
}
return self;
}
- (void)awakeFromNib
- (void)windowDidLoad
{
[_window setTitle: _NS("Video Effects")];
[_window setExcludedFromWindowsMenu:YES];
[_window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
[self.window setTitle: _NS("Video Effects")];
[self.window setExcludedFromWindowsMenu:YES];
[self.window setCollectionBehavior: NSWindowCollectionBehaviorFullScreenAuxiliary];
[[_tabView tabViewItemAtIndex:[_tabView indexOfTabViewItemWithIdentifier:@"basic"]] setLabel:_NS("Basic")];
[[_tabView tabViewItemAtIndex:[_tabView indexOfTabViewItemWithIdentifier:@"crop"]] setLabel:_NS("Crop")];
......@@ -217,8 +207,8 @@
- (void)updateCocoaWindowLevel:(NSInteger)i_level
{
if (_window && [_window isVisible] && [_window level] != i_level)
[_window setLevel: i_level];
if (self.window && [self.window isVisible] && [self.window level] != i_level)
[self.window setLevel: i_level];
}
#pragma mark -
......@@ -562,11 +552,11 @@
- (IBAction)toggleWindow:(id)sender
{
if ([_window isKeyWindow])
[_window orderOut:sender];
if ([self.window isKeyWindow])
[self.window orderOut:sender];
else {
[_window setLevel: [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]];
[_window makeKeyAndOrderFront:sender];
[self.window setLevel: [[[VLCMain sharedInstance] voutController] currentStatusWindowLevel]];
[self.window makeKeyAndOrderFront:sender];
}
}
......@@ -683,7 +673,7 @@
[panel setOKButtonLabel: _NS("Save")];
[panel setTarget:self];
[panel runModalForWindow:_window];
[panel runModalForWindow:self.window];
}
- (void)panel:(VLCEnterTextPanel *)panel returnValue:(NSUInteger)value text:(NSString *)text
......@@ -706,7 +696,7 @@
[alert setMessageText:_NS("Please enter a unique name for the new profile.")];
[alert setInformativeText:_NS("Multiple profiles with the same name are not allowed.")];
[alert beginSheetModalForWindow:_window
[alert beginSheetModalForWindow:self.window
modalDelegate:nil
didEndSelector:nil
contextInfo:nil];
......@@ -745,7 +735,7 @@
[panel setPopupButtonContent:[[NSUserDefaults standardUserDefaults] objectForKey:@"VideoEffectProfileNames"]];
[panel setTarget:self];
[panel runModalForWindow:_window];
[panel runModalForWindow:self.window];
}
- (void)panel:(VLCSelectItemInPopupPanel *)panel returnValue:(NSUInteger)value item:(NSUInteger)item
......
......@@ -67,6 +67,7 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
@class VLCDebugMessageVisualizer;
@class VLCTrackSynchronization;
@class VLCAudioEffects;
@class VLCVideoEffects;
@interface VLCMain : NSObject <NSWindowDelegate, NSApplicationDelegate>
{
......@@ -95,6 +96,7 @@ static NSString * VLCInputChangedNotification = @"VLCInputChangedNotification";
- (VLCTrackSynchronization *)trackSyncPanel;
- (VLCAudioEffects *)audioEffectsPanel;
- (VLCVideoEffects *)videoEffectsPanel;
- (void)setActiveVideoPlayback:(BOOL)b_value;
- (BOOL)activeVideoPlayback;
......
......@@ -157,6 +157,7 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
VLCDebugMessageVisualizer *_messagePanelController;
VLCTrackSynchronization *_trackSyncPanel;
VLCAudioEffects *_audioEffectsPanel;
VLCVideoEffects *_videoEffectsPanel;
bool b_intf_terminating; /* Makes sure applicationWillTerminate will be called only once */
}
......@@ -344,7 +345,7 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
playlist_t * p_playlist = pl_Get(p_intf);
/* save current video and audio profiles */
[[VLCVideoEffects sharedInstance] saveCurrentProfile];
[[self videoEffectsPanel] saveCurrentProfile];
[[self audioEffectsPanel] saveCurrentProfile];
/* Save some interface state in configuration, at module quit */
......@@ -544,6 +545,14 @@ static int ShowController(vlc_object_t *p_this, const char *psz_variable,
return _audioEffectsPanel;
}
- (VLCVideoEffects *)videoEffectsPanel
{
if (!_videoEffectsPanel)
_videoEffectsPanel = [[VLCVideoEffects alloc] init];
return _videoEffectsPanel;
}
- (VLCBookmarks *)bookmarks
{
if (!_bookmarks)
......
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