2009-02-22 22:28:09 +00:00
|
|
|
//
|
|
|
|
// MiniWindow.m
|
|
|
|
// Cog
|
|
|
|
//
|
|
|
|
// Created by Vincent Spader on 2/22/09.
|
|
|
|
// Copyright 2009 __MyCompanyName__. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "MiniWindow.h"
|
|
|
|
|
|
|
|
|
|
|
|
@implementation MiniWindow
|
|
|
|
|
2018-06-28 10:59:59 +00:00
|
|
|
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSWindowStyleMask)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation
|
2009-02-22 22:28:09 +00:00
|
|
|
{
|
|
|
|
self = [super initWithContentRect:contentRect styleMask:windowStyle backing:bufferingType defer:deferCreation];
|
|
|
|
if (self)
|
|
|
|
{
|
|
|
|
[self setShowsResizeIndicator:NO];
|
|
|
|
[self setExcludedFromWindowsMenu:YES];
|
2013-10-11 01:14:35 +00:00
|
|
|
[self setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary];
|
2009-02-22 22:28:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize {
|
|
|
|
// Do not allow height to change
|
|
|
|
proposedFrameSize.height = [self frame].size.height;
|
|
|
|
|
|
|
|
return proposedFrameSize;
|
|
|
|
}
|
|
|
|
|
2013-10-11 19:02:05 +00:00
|
|
|
- (void)toggleToolbarShown:(id)sender {
|
|
|
|
// Mini window IS the toolbar, no point in hiding it.
|
|
|
|
// Do nothing!
|
|
|
|
}
|
|
|
|
|
2018-09-27 03:30:02 +00:00
|
|
|
- (void)keyDown:(NSEvent *)e {
|
|
|
|
unsigned int modifiers = [e modifierFlags] & (NSCommandKeyMask | NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask);
|
|
|
|
NSString *characters = [e characters];
|
|
|
|
unichar c;
|
|
|
|
|
|
|
|
if ([characters length] != 1)
|
|
|
|
{
|
|
|
|
[super keyDown:e];
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
c = [characters characterAtIndex:0];
|
|
|
|
if (modifiers == 0 && c == ' ')
|
|
|
|
{
|
|
|
|
[playbackController playPauseResume:self];
|
|
|
|
}
|
|
|
|
else if (modifiers == 0 && (c == NSEnterCharacter || c == NSCarriageReturnCharacter))
|
|
|
|
{
|
|
|
|
[playbackController play:self];
|
|
|
|
}
|
|
|
|
else if (modifiers == 0 && c == NSLeftArrowFunctionKey)
|
|
|
|
{
|
|
|
|
[playbackController eventSeekBackward:self];
|
|
|
|
}
|
|
|
|
else if (modifiers == 0 && c == NSRightArrowFunctionKey)
|
|
|
|
{
|
|
|
|
[playbackController eventSeekForward:self];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
[super keyDown:e];
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-10-11 19:02:05 +00:00
|
|
|
|
2009-02-22 22:28:09 +00:00
|
|
|
@end
|