Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
matteorattotti committed Jan 30, 2010
0 parents commit 19667ca
Show file tree
Hide file tree
Showing 24 changed files with 3,593 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
@@ -0,0 +1,8 @@
build
Build
whamoo.pbxuser
whamoo.perpspectivev3
whamoo.perspectivev3
whamoo.mode1v3
.DS_Store
*.pyc
Binary file added English.lproj/InfoPlist.strings
Binary file not shown.
2,029 changes: 2,029 additions & 0 deletions English.lproj/MainMenu.xib

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions Info.plist
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.${PRODUCT_NAME:identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
25 changes: 25 additions & 0 deletions SFCursorBallonView.h
@@ -0,0 +1,25 @@
//
// SFCursorBallonView.h
// ShinyRuler
//
// Created by Matteo Rattotti on 1/9/10.
// Copyright 2010 www.shinyfrog.net. All rights reserved.
//

#import <Cocoa/Cocoa.h>


@interface SFCursorBallonView : NSView {
int currentValue;

NSColor *initialColor;
NSColor *finalColor;
NSColor *strokeColor;
NSGradient *bgGradient;

BOOL orizontal;

}
- (void) setCurrentValue: (int) newValue;

@end
84 changes: 84 additions & 0 deletions SFCursorBallonView.m
@@ -0,0 +1,84 @@
//
// SFCursorBallonView.m
// ShinyRuler
//
// Created by Matteo Rattotti on 1/9/10.
// Copyright 2010 www.shinyfrog.net. All rights reserved.
//

#import "SFCursorBallonView.h"


@implementation SFCursorBallonView

- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
currentValue = -1;

initialColor = [NSColor colorWithCalibratedRed:0.49 green:0.58 blue:0.65 alpha:1];
finalColor = [NSColor colorWithCalibratedRed:0.69 green:0.74 blue:0.77 alpha:1];
strokeColor = [[NSColor colorWithCalibratedRed:0.41 green:0.41 blue:0.41 alpha:0.9]retain];
bgGradient = [[NSGradient alloc] initWithStartingColor:initialColor endingColor:finalColor];

if(frame.size.width > frame.size.height)
orizontal = YES;
}
return self;
}

- (void) dealloc{
[bgGradient release];
[strokeColor release];
[super dealloc];
}

- (void)drawRect:(NSRect)rect {
NSRect newFrame;// = NSInsetRect(rect, 1, 1);
if(orizontal)
newFrame = NSMakeRect(currentValue, 1, 58, 18);
else
newFrame = NSMakeRect(1, rect.size.height - currentValue - 22 , 58, 18);

NSBezierPath *ballonBox = [NSBezierPath bezierPathWithRoundedRect:newFrame xRadius:9 yRadius:9];
[bgGradient drawInBezierPath:ballonBox angle:90];
[strokeColor set];
[ballonBox stroke];

NSString *valueString = [NSString stringWithFormat:@"%d", currentValue];

NSFont *textFont = [NSFont fontWithName:@"Lucida Grande" size:10];

NSMutableDictionary *textAttr = [NSMutableDictionary dictionaryWithObjectsAndKeys:
textFont, NSFontAttributeName,
[NSColor whiteColor], NSForegroundColorAttributeName,
nil];

NSMutableDictionary *shadowTextAttr = [NSMutableDictionary dictionaryWithObjectsAndKeys:
textFont, NSFontAttributeName,
[NSColor colorWithCalibratedRed:0.41 green:0.41 blue:0.41 alpha:1.0], NSForegroundColorAttributeName,
nil];


NSSize textSize = [valueString sizeWithAttributes:textAttr];

NSPoint titleTextPoint;
if(orizontal)
titleTextPoint = NSMakePoint(newFrame.origin.x + (newFrame.size.width / 2.0) - (textSize.width / 2.0) , (newFrame.size.height - textSize.height)/2.0 + 1);
else
titleTextPoint = NSMakePoint(newFrame.origin.x + (newFrame.size.width / 2.0) - (textSize.width / 2.0) , rect.size.height - currentValue - 20);

NSPoint shadowTextPoint = titleTextPoint;
shadowTextPoint.y += 1;
[valueString drawAtPoint:shadowTextPoint withAttributes:shadowTextAttr];
[valueString drawAtPoint:titleTextPoint withAttributes:textAttr];

}

- (void) setCurrentValue: (int) newValue {
currentValue = newValue;
[self display];
}


@end
19 changes: 19 additions & 0 deletions SFCursorView.h
@@ -0,0 +1,19 @@
//
// SFCursorView.h
// ShinyRuler
//
// Created by Matteo Rattotti on 1/7/10.
// Copyright 2010 www.shinyfrog.net. All rights reserved.
//

#import <Cocoa/Cocoa.h>


@interface SFCursorView : NSView {
int currentMark;
BOOL orizontal;
BOOL locked;
}
- (void) setCurrentMark: (int) newMark;

@end
76 changes: 76 additions & 0 deletions SFCursorView.m
@@ -0,0 +1,76 @@
//
// SFCursorView.m
// ShinyRuler
//
// Created by Matteo Rattotti on 1/7/10.
// Copyright 2010 www.shinyfrog.net. All rights reserved.
//

#import "SFCursorView.h"


@implementation SFCursorView

- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
// Initialization code here.
currentMark = -1000000;

// Setting orientation mode
if(frame.size.width > frame.size.height){
orizontal = 1;
[self setAutoresizingMask:NSViewWidthSizable | NSViewMaxXMargin];
}
else{
orizontal = 0;
[self setAutoresizingMask:NSViewHeightSizable | NSViewMaxYMargin];
}

}
locked = NO;
return self;
}

- (void)drawRect:(NSRect)rect {
if(currentMark != -1000000 ) {

NSBezierPath* markSteps = [NSBezierPath bezierPath];
float borderWidth = 1.0;
[markSteps setLineWidth:borderWidth];
if(orizontal) {
[markSteps moveToPoint:NSMakePoint(currentMark, [self frame].size.height)];
[markSteps lineToPoint:NSMakePoint(currentMark, 0)];
}
else {
[markSteps moveToPoint:NSMakePoint(0, currentMark)];
[markSteps lineToPoint:NSMakePoint([self frame].size.width, currentMark)];
}

[[NSColor colorWithCalibratedRed:0.33 green:0.33 blue:0.33 alpha:1.0]set];

NSGraphicsContext* gc = [NSGraphicsContext currentContext];
[gc setShouldAntialias:NO];

[markSteps stroke];
}

}

- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent {
return YES;
}


/* The view is flipped */
- (BOOL)isFlipped{
return YES;
}

- (void) setCurrentMark: (int) newMark {
currentMark = newMark;
[self display];
}


@end
28 changes: 28 additions & 0 deletions SFResizeControl.h
@@ -0,0 +1,28 @@
//
// SFResizeControl.h
// resizable
//
// Created by Matteo rattotti on 1/9/08.
// Copyright 2008 www.shinyfrog.net. All rights reserved.
//

#import <Cocoa/Cocoa.h>


@interface SFResizeControl : NSView {
float prevX;
float prevY;
NSSize prevSize;

NSCursor *resizeCursor;
NSTrackingRectTag trackingRect;

}
- (void)resizeWindowToSize: (NSSize)newSize;


- (void)resetCursorRects;
- (void)clearTrackingRect;
- (void)setTrackingRect;

@end

0 comments on commit 19667ca

Please sign in to comment.