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
iMokhles
authored and
iMokhles
committed
May 31, 2016
1 parent
8137b8f
commit 9f128e4
Showing
35 changed files
with
3,726 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
source code/IMSign.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 @@ | ||
// | ||
// AppDelegate.h | ||
// IMSign | ||
// | ||
// Created by iMokhles on 16/05/16. | ||
// Copyright © 2016 iMokhles. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
@interface AppDelegate : NSObject <NSApplicationDelegate> | ||
|
||
|
||
@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,29 @@ | ||
// | ||
// AppDelegate.m | ||
// IMSign | ||
// | ||
// Created by iMokhles on 16/05/16. | ||
// Copyright © 2016 iMokhles. All rights reserved. | ||
// | ||
|
||
#import "AppDelegate.h" | ||
|
||
@interface AppDelegate () | ||
|
||
@end | ||
|
||
@implementation AppDelegate | ||
|
||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { | ||
// Insert code here to initialize your application | ||
} | ||
|
||
- (void)applicationWillTerminate:(NSNotification *)aNotification { | ||
// Insert code here to tear down your application | ||
} | ||
|
||
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication { | ||
return YES; | ||
} | ||
|
||
@end |
68 changes: 68 additions & 0 deletions
68
source code/IMSign/Assets.xcassets/AppIcon.appiconset/Contents.json
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,68 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"size" : "16x16", | ||
"idiom" : "mac", | ||
"filename" : "icon_16x16.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"size" : "16x16", | ||
"idiom" : "mac", | ||
"filename" : "icon_32x32.png", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"size" : "32x32", | ||
"idiom" : "mac", | ||
"filename" : "icon_32x32-1.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"size" : "32x32", | ||
"idiom" : "mac", | ||
"filename" : "icon_32x32@2x.png", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"size" : "128x128", | ||
"idiom" : "mac", | ||
"filename" : "icon_128x128.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"size" : "128x128", | ||
"idiom" : "mac", | ||
"filename" : "icon_256x256.png", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"size" : "256x256", | ||
"idiom" : "mac", | ||
"filename" : "icon_256x256-1.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"size" : "256x256", | ||
"idiom" : "mac", | ||
"filename" : "icon_512x512.png", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"size" : "512x512", | ||
"idiom" : "mac", | ||
"filename" : "icon_512x512-1.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"size" : "512x512", | ||
"idiom" : "mac", | ||
"filename" : "icon_512x512@2x.png", | ||
"scale" : "2x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Binary file added
BIN
+15.3 KB
source code/IMSign/Assets.xcassets/AppIcon.appiconset/icon_128x128.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+36.6 KB
source code/IMSign/Assets.xcassets/AppIcon.appiconset/icon_256x256-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+36.6 KB
source code/IMSign/Assets.xcassets/AppIcon.appiconset/icon_256x256.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.17 KB
source code/IMSign/Assets.xcassets/AppIcon.appiconset/icon_32x32-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.68 KB
source code/IMSign/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+89 KB
source code/IMSign/Assets.xcassets/AppIcon.appiconset/icon_512x512-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+179 KB
source code/IMSign/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
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,21 @@ | ||
// | ||
// DJProgressIndicator.h | ||
// Playground | ||
// | ||
// Created by Daniel Jackson on 5/11/14. | ||
// Copyright (c) 2014 Daniel Jackson. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
@interface DJActivityIndicator : NSView | ||
|
||
@property BOOL isAnimating; | ||
|
||
- (void)setColor:(NSColor *)value; | ||
- (void)setBackgroundColor:(NSColor *)value; | ||
|
||
- (void)stopAnimation:(id)sender; | ||
- (void)startAnimation:(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,208 @@ | ||
// | ||
// DJProgressIndicator.m | ||
// Playground | ||
// | ||
// Created by Daniel Jackson on 5/11/14. | ||
// Copyright (c) 2014 Daniel Jackson. All rights reserved. | ||
// | ||
|
||
#import "DJActivityIndicator.h" | ||
|
||
#define kAlphaWhenStopped 0.15 | ||
#define kFadeMultiplier 0.85 | ||
|
||
@interface DJActivityIndicator () | ||
{ | ||
int position; | ||
NSMutableArray* finColors; | ||
|
||
BOOL isFadingOut; | ||
NSTimer* animationTimer; | ||
|
||
NSColor* foreColor; | ||
NSColor* backColor; | ||
} | ||
@end | ||
|
||
@implementation DJActivityIndicator | ||
|
||
- (id)initWithFrame:(NSRect)frame | ||
{ | ||
self = [super initWithFrame:frame]; | ||
if (self) { | ||
position = 0; | ||
int numFins = 12; | ||
|
||
finColors = [[NSMutableArray alloc] initWithCapacity:numFins]; | ||
|
||
_isAnimating = NO; | ||
isFadingOut = NO; | ||
|
||
foreColor = [NSColor blackColor]; | ||
backColor = [NSColor clearColor]; | ||
|
||
for(int i=0; i<numFins; i++) | ||
{ | ||
[finColors addObject:foreColor]; | ||
} | ||
} | ||
return self; | ||
} | ||
|
||
- (void)drawRect:(NSRect)dirtyRect | ||
{ | ||
[super drawRect:dirtyRect]; | ||
|
||
NSSize size = [self bounds].size; | ||
CGFloat theMaxSize; | ||
if(size.width >= size.height) | ||
theMaxSize = size.height; | ||
else | ||
theMaxSize = size.width; | ||
|
||
[backColor set]; | ||
[NSBezierPath fillRect:[self bounds]]; | ||
|
||
CGContextRef currentContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; | ||
[NSGraphicsContext saveGraphicsState]; | ||
|
||
CGContextTranslateCTM(currentContext,[self bounds].size.width/2,[self bounds].size.height/2); | ||
|
||
NSBezierPath *path = [[NSBezierPath alloc] init]; | ||
CGFloat lineWidth = 0.0859375 * theMaxSize; | ||
CGFloat lineStart = 0.234375 * theMaxSize; | ||
CGFloat lineEnd = 0.421875 * theMaxSize; | ||
[path setLineWidth:lineWidth]; | ||
[path setLineCapStyle:NSRoundLineCapStyle]; | ||
[path moveToPoint:NSMakePoint(0,lineStart)]; | ||
[path lineToPoint:NSMakePoint(0,lineEnd)]; | ||
|
||
for (int i=0; i<finColors.count; i++) { | ||
if(_isAnimating) { | ||
[(NSColor*)finColors[i] set]; | ||
} | ||
else { | ||
[[foreColor colorWithAlphaComponent:kAlphaWhenStopped] set]; | ||
} | ||
|
||
[path stroke]; | ||
|
||
CGContextRotateCTM(currentContext, 6.282185/finColors.count); | ||
} | ||
path = nil; | ||
|
||
[NSGraphicsContext restoreGraphicsState]; | ||
} | ||
|
||
- (void)startAnimation:(id)sender | ||
{ | ||
if (_isAnimating && !isFadingOut) return; | ||
|
||
[self actuallyStartAnimation]; | ||
} | ||
|
||
- (void)stopAnimation:(id)sender | ||
{ | ||
isFadingOut = YES; | ||
} | ||
|
||
- (void)setColor:(NSColor *)value | ||
{ | ||
if (foreColor != value) { | ||
foreColor = nil; | ||
foreColor = value; | ||
|
||
for (int i=0; i<finColors.count; i++) { | ||
CGFloat alpha = [finColors[i] alphaComponent]; | ||
[finColors setObject:[foreColor colorWithAlphaComponent:alpha] atIndexedSubscript:i]; | ||
} | ||
|
||
[self setNeedsDisplay:YES]; | ||
} | ||
} | ||
|
||
- (void)setBackgroundColor:(NSColor *)value | ||
{ | ||
if (backColor != value) { | ||
backColor = nil; | ||
backColor = value; | ||
[self setNeedsDisplay:YES]; | ||
} | ||
} | ||
|
||
- (void)updateFrame:(NSTimer *)timer | ||
{ | ||
if(position > 0) { | ||
position--; | ||
} | ||
else { | ||
position = (int)finColors.count - 1; | ||
} | ||
|
||
CGFloat minAlpha = kAlphaWhenStopped; | ||
for (int i=0; i<finColors.count; i++) { | ||
CGFloat newAlpha = [finColors[i] alphaComponent] * kFadeMultiplier; | ||
if (newAlpha < minAlpha) | ||
newAlpha = minAlpha; | ||
|
||
finColors[i] = [foreColor colorWithAlphaComponent:newAlpha]; | ||
} | ||
|
||
if (isFadingOut) { | ||
BOOL done = YES; | ||
for (int i=0; i<finColors.count; i++) { | ||
if (fabs([finColors[i] alphaComponent] - minAlpha) > 0.01) { | ||
done = NO; | ||
break; | ||
} | ||
} | ||
if (done) { | ||
[self actuallyStopAnimation]; | ||
} | ||
} | ||
else { | ||
finColors[position] = foreColor; | ||
} | ||
|
||
[self setNeedsDisplay:YES]; | ||
|
||
|
||
} | ||
|
||
- (void)actuallyStartAnimation | ||
{ | ||
[self actuallyStopAnimation]; | ||
|
||
_isAnimating = YES; | ||
isFadingOut = NO; | ||
|
||
position = 1; | ||
|
||
animationTimer = [NSTimer timerWithTimeInterval:(NSTimeInterval)0.05 | ||
target:self | ||
selector:@selector(updateFrame:) | ||
userInfo:nil | ||
repeats:YES]; | ||
|
||
[[NSRunLoop currentRunLoop] addTimer:animationTimer forMode:NSRunLoopCommonModes]; | ||
[[NSRunLoop currentRunLoop] addTimer:animationTimer forMode:NSDefaultRunLoopMode]; | ||
[[NSRunLoop currentRunLoop] addTimer:animationTimer forMode:NSEventTrackingRunLoopMode]; | ||
} | ||
|
||
- (void)actuallyStopAnimation | ||
{ | ||
_isAnimating = NO; | ||
isFadingOut = NO; | ||
|
||
if (animationTimer) { | ||
// we were using timer-based animation | ||
[animationTimer invalidate]; | ||
animationTimer = nil; | ||
} | ||
//[self setNeedsDisplay:YES]; | ||
} | ||
|
||
|
||
|
||
|
||
@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,15 @@ | ||
// | ||
// CPBezierPath.h | ||
// Cloud Play OSX | ||
// | ||
// Created by Daniel Jackson on 5/11/14. | ||
// Copyright (c) 2014 Daniel Jackson. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
@interface DJBezierPath : NSBezierPath | ||
|
||
- (CGPathRef)quartzPath; | ||
|
||
@end |
Oops, something went wrong.