This repository has been archived by the owner on Apr 24, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
5,403 additions
and
3,031 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
/build | ||
*.pbxuser | ||
*.mode1v3 | ||
.DS_Store | ||
.DS_Store | ||
CamHolderApp.xcodeproj/xcuserdata/ | ||
CamHolderApp.xcodeproj/project.xcworkspace/xcuserdata/ |
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
CamHolderApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// CHApplicationDelegate.h | ||
// CamHolderApp | ||
// | ||
// Created by Heiko Behrens on 31.01.12. | ||
// Copyright (c) 2012 BeamApp. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface CHApplicationDelegate : NSObject<NSApplicationDelegate> | ||
|
||
-(IBAction)toggleFullscreen:(id)sender; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// | ||
// CHApplicationDelegate.m | ||
// CamHolderApp | ||
// | ||
// Created by Heiko Behrens on 31.01.12. | ||
// Copyright (c) 2012 BeamApp. All rights reserved. | ||
// | ||
|
||
#import "CHApplicationDelegate.h" | ||
#import "CHDocument.h" | ||
#import "CHWindowController.h" | ||
|
||
@implementation CHApplicationDelegate | ||
|
||
-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender { | ||
return YES; | ||
} | ||
|
||
-(void)applicationDidFinishLaunching:(NSNotification *)notification { | ||
NSArray *allDevices = [CHDocument cachedCaptureDevices]; | ||
if(allDevices.count <= 0) { | ||
NSAlert *alert = [NSAlert alertWithMessageText:@"Camera not found" | ||
defaultButton:nil alternateButton:nil otherButton:nil | ||
informativeTextWithFormat:@"Make sure to attach at least one camera of the model 'Microsoft LifeCam Studio' before running this application."]; | ||
[alert runModal]; | ||
[[NSApplication sharedApplication] terminate:self]; | ||
} | ||
} | ||
|
||
-(void)onScreen:(NSScreen*)screen andControllers:(NSArray*)controllers setFullscreen:(BOOL)fullscreen { | ||
NSRect r = screen.frame; | ||
BOOL alignHorizontally = [[controllers valueForKeyPath:@"@max.document.rotatedVertically"] boolValue]; | ||
r.size.width /= alignHorizontally ? controllers.count : 1; | ||
r.size.height /= alignHorizontally ? 1 : controllers.count; | ||
NSSize delta = alignHorizontally ? NSMakeSize(r.size.width, 0) : NSMakeSize(0, r.size.height); | ||
|
||
SEL compareSelector = alignHorizontally ? @selector(horizontalCompare:) : @selector(verticalCompare:); | ||
controllers = [controllers sortedArrayUsingSelector:compareSelector]; | ||
|
||
[NSAnimationContext beginGrouping]; | ||
for(CHWindowController *controller in controllers) { | ||
if(fullscreen) { | ||
[controller displayAsFullScreenInRect:r]; | ||
r = NSOffsetRect(r, delta.width, delta.height); | ||
} else { | ||
controller.isFullscreen = NO; | ||
} | ||
} | ||
[NSAnimationContext endGrouping]; | ||
} | ||
|
||
-(IBAction)toggleFullscreen:(id)sender { | ||
// collect controllers per screen. This has to be more consize... | ||
NSMutableArray *controllersPerScreen = [NSMutableArray array]; | ||
for(NSScreen *screen in NSScreen.screens) { | ||
[controllersPerScreen addObject:[NSMutableArray array]]; | ||
} | ||
|
||
BOOL allToFullscreen = YES; | ||
for(CHDocument *document in [[NSDocumentController sharedDocumentController] documents]) { | ||
for(CHWindowController *controller in document.windowControllers) { | ||
if([controller isKindOfClass:CHWindowController.class] && controller.canBeFullscreen) { | ||
NSMutableArray *controllersAtThisScreen = [controllersPerScreen objectAtIndex:[NSScreen.screens indexOfObject:controller.window.screen]]; | ||
[controllersAtThisScreen addObject:controller]; | ||
allToFullscreen = allToFullscreen && !controller.isFullscreen; | ||
} | ||
} | ||
} | ||
|
||
// actually apply fullscreen operation per screen | ||
for(NSScreen *screen in NSScreen.screens) { | ||
NSArray *controllers = [controllersPerScreen objectAtIndex:[NSScreen.screens indexOfObject:screen]]; | ||
if(controllers.count > 0) | ||
[self onScreen: screen andControllers:controllers setFullscreen:allToFullscreen]; | ||
} | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// chaDocument.h | ||
// CamHolderApp | ||
// | ||
// Created by Heiko Behrens on 31.01.12. | ||
// Copyright (c) 2012 BeamApp. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
#import <QTKit/QTKit.h> | ||
#import "UVCCameraControl.h" | ||
|
||
extern NSArray* CHCachedCaptureDevices; | ||
|
||
@interface CHDocument : NSDocument { | ||
UVCCameraControl *_cameraControl; | ||
} | ||
|
||
@property (nonatomic, assign) BOOL isAutoExposureActive; | ||
@property (nonatomic, assign) float exposureTimeFactor; | ||
@property (nonatomic, assign) BOOL isAutoFocusActive; | ||
@property (nonatomic, assign) float focusFactor; | ||
|
||
-(void)readCameraValuesIntoProperties; | ||
|
||
@property (nonatomic, readonly) BOOL isZoomed; | ||
|
||
@property (nonatomic, readonly) NSArray* captureDevices; | ||
@property (nonatomic, retain) QTCaptureDevice* activeCaptureDevice; | ||
-(void)tryToHaveActiveCaptureDevice; | ||
|
||
@property (nonatomic, assign) NSRect normalizedCroppingRect; | ||
@property (nonatomic, assign) BOOL isMirroredHorizontally; | ||
@property (nonatomic, assign) BOOL isMirroredVertically; | ||
@property (nonatomic, assign) float rotation; | ||
@property (nonatomic, readonly) BOOL rotatedVertically; | ||
|
||
-(void)resetZoom; | ||
|
||
@property (nonatomic, assign) BOOL showsInspector; | ||
@property (nonatomic, assign) NSSize contentSize; | ||
|
||
-(void)toggleInspector:(id)sender; | ||
|
||
+(NSArray*)cachedCaptureDevices; | ||
|
||
@end |
Oops, something went wrong.